forked from D-Net/dnet-hadoop
apply changes in D-Net/dnet-hadoop#40 (comment)
This commit is contained in:
parent
3ab4809d31
commit
367203f412
|
@ -29,7 +29,7 @@ public class QueryInformationSystem {
|
||||||
"</community>";
|
"</community>";
|
||||||
|
|
||||||
public CommunityMap getCommunityMap()
|
public CommunityMap getCommunityMap()
|
||||||
throws ISLookUpException {
|
throws ISLookUpException, DocumentException {
|
||||||
return getMap(isLookUp.quickSearchProfile(XQUERY));
|
return getMap(isLookUp.quickSearchProfile(XQUERY));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,21 +42,16 @@ public class QueryInformationSystem {
|
||||||
this.isLookUp = isLookUpService;
|
this.isLookUp = isLookUpService;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommunityMap getMap(List<String> communityMap) {
|
private CommunityMap getMap(List<String> communityMap) throws DocumentException {
|
||||||
final CommunityMap map = new CommunityMap();
|
final CommunityMap map = new CommunityMap();
|
||||||
|
|
||||||
communityMap.stream().forEach(xml -> {
|
for (String xml : communityMap) {
|
||||||
final Document doc;
|
final Document doc;
|
||||||
try {
|
|
||||||
doc = new SAXReader().read(new StringReader(xml));
|
doc = new SAXReader().read(new StringReader(xml));
|
||||||
Element root = doc.getRootElement();
|
Element root = doc.getRootElement();
|
||||||
map.put(root.attribute("id").getValue(), root.attribute("label").getValue());
|
map.put(root.attribute("id").getValue(), root.attribute("label").getValue());
|
||||||
} catch (DocumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue