|
|
@ -9,7 +9,7 @@ import com.fr.stable.xml.XMLPrintWriter; |
|
|
|
import com.fr.stable.xml.XMLReadable; |
|
|
|
import com.fr.stable.xml.XMLReadable; |
|
|
|
import com.fr.stable.xml.XMLable; |
|
|
|
import com.fr.stable.xml.XMLable; |
|
|
|
import com.fr.stable.xml.XMLableReader; |
|
|
|
import com.fr.stable.xml.XMLableReader; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.LinkedHashMap; |
|
|
|
import java.util.LinkedHashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
@ -99,7 +99,6 @@ public class AlphaFineConfigManager implements XMLable { |
|
|
|
private String cacheBuildNO; |
|
|
|
private String cacheBuildNO; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// todo 暂不持久化 方便测试
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* key: 登录的bbs用户 |
|
|
|
* key: 登录的bbs用户 |
|
|
|
* value: alphaFine历史搜索记录 |
|
|
|
* value: alphaFine历史搜索记录 |
|
|
@ -154,6 +153,10 @@ public class AlphaFineConfigManager implements XMLable { |
|
|
|
} else if (reader.isChildNode()) { |
|
|
|
} else if (reader.isChildNode()) { |
|
|
|
if (ComparatorUtils.equals(reader.getTagName(), "ActionSearchTextCache")) { |
|
|
|
if (ComparatorUtils.equals(reader.getTagName(), "ActionSearchTextCache")) { |
|
|
|
readActionSearchTextCacheXML(reader); |
|
|
|
readActionSearchTextCacheXML(reader); |
|
|
|
|
|
|
|
} else if ("SearchHistory".equals(reader.getTagName())) { |
|
|
|
|
|
|
|
readHistorySearch(reader); |
|
|
|
|
|
|
|
} else if ("ReadSet".equals(reader.getTagName())) { |
|
|
|
|
|
|
|
readReadSet(reader); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -180,6 +183,47 @@ public class AlphaFineConfigManager implements XMLable { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void readHistorySearch(XMLableReader reader) { |
|
|
|
|
|
|
|
reader.readXMLObject(new XMLReadable() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void readXML(XMLableReader xmLableReader) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(reader.getTagName(), "history")) { |
|
|
|
|
|
|
|
String tmpVal = reader.getElementValue(); |
|
|
|
|
|
|
|
if (tmpVal != null) { |
|
|
|
|
|
|
|
tmpVal = tmpVal.replace("[",StringUtils.EMPTY).replace("]",StringUtils.EMPTY); |
|
|
|
|
|
|
|
Stack<String> stack = new SizedStack<>(3); |
|
|
|
|
|
|
|
List<String> historyList = Arrays.asList(tmpVal.split(",")); |
|
|
|
|
|
|
|
for (String history : historyList) { |
|
|
|
|
|
|
|
stack.add(history.trim()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
historySearchMap.put(reader.getAttrAsString("user", StringUtils.EMPTY), stack); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void readReadSet(XMLableReader reader) { |
|
|
|
|
|
|
|
reader.readXMLObject(new XMLReadable() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void readXML(XMLableReader xmLableReader) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(reader.getTagName(), "readId")) { |
|
|
|
|
|
|
|
String tmpVal = reader.getElementValue(); |
|
|
|
|
|
|
|
if (tmpVal != null) { |
|
|
|
|
|
|
|
tmpVal = tmpVal.replace("[",StringUtils.EMPTY).replace("]",StringUtils.EMPTY); |
|
|
|
|
|
|
|
String[] idArr = tmpVal.split(","); |
|
|
|
|
|
|
|
Set<Long> setId = new HashSet<>(); |
|
|
|
|
|
|
|
for (String id : idArr) { |
|
|
|
|
|
|
|
setId.add(Long.parseLong(id.trim())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
readSetMap.put(reader.getAttrAsString("user", StringUtils.EMPTY), setId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void writeXML(XMLPrintWriter writer) { |
|
|
|
public void writeXML(XMLPrintWriter writer) { |
|
|
|
writer.startTAG("AlphaFineConfigManager"); |
|
|
|
writer.startTAG("AlphaFineConfigManager"); |
|
|
@ -198,6 +242,8 @@ public class AlphaFineConfigManager implements XMLable { |
|
|
|
.attr("needIntelligentCustomerService", this.isNeedIntelligentCustomerService()) |
|
|
|
.attr("needIntelligentCustomerService", this.isNeedIntelligentCustomerService()) |
|
|
|
.attr("productDynamics", this.isProductDynamics()); |
|
|
|
.attr("productDynamics", this.isProductDynamics()); |
|
|
|
writeActionSearchTextCacheXML(writer); |
|
|
|
writeActionSearchTextCacheXML(writer); |
|
|
|
|
|
|
|
writeSearchHistory(writer); |
|
|
|
|
|
|
|
writeReadSet(writer); |
|
|
|
writer.end(); |
|
|
|
writer.end(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -212,6 +258,22 @@ public class AlphaFineConfigManager implements XMLable { |
|
|
|
writer.end(); |
|
|
|
writer.end(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void writeSearchHistory(XMLPrintWriter writer) { |
|
|
|
|
|
|
|
writer.startTAG("SearchHistory"); |
|
|
|
|
|
|
|
for (Map.Entry<String, Stack<String>> entry : historySearchMap.entrySet()) { |
|
|
|
|
|
|
|
writer.startTAG("history").attr("user", entry.getKey()).textNode(entry.getValue().toString()).end(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
writer.end(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void writeReadSet(XMLPrintWriter writer) { |
|
|
|
|
|
|
|
writer.startTAG("ReadSet"); |
|
|
|
|
|
|
|
for (Map.Entry<String, Set<Long>> entry : readSetMap.entrySet()) { |
|
|
|
|
|
|
|
writer.startTAG("readId").attr("user", entry.getKey()).textNode(entry.getValue().toString()).end(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
writer.end(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isSearchOnLine() { |
|
|
|
public boolean isSearchOnLine() { |
|
|
|
return searchOnLine; |
|
|
|
return searchOnLine; |
|
|
|
} |
|
|
|
} |
|
|
|