Revision 52869
Added by Miriam Baglioni almost 6 years ago
LoadBulkTaggingConfigurationJobNode.java | ||
---|---|---|
67 | 67 |
Configuration c = new Configuration(); |
68 | 68 |
|
69 | 69 |
for(String r : res){ |
70 |
log.info("result from xquery " + r);
|
|
70 |
log.debug("result from xquery " + r);
|
|
71 | 71 |
c.addCommunity(parseCommunity(r)); |
72 | 72 |
} |
73 | 73 |
|
74 |
token.getEnv().setAttribute(getBulkTaggingConfParam(), c.getTaggingConfiguration());
|
|
74 |
final String taggingConfiguration = c.getTaggingConfiguration();
|
|
75 | 75 |
|
76 |
log.info("tagging configuration " + c.getTaggingConfiguration()); |
|
76 |
token.getEnv().setAttribute(getBulkTaggingConfParam(), taggingConfiguration); |
|
77 |
|
|
78 |
log.debug("tagging configuration " + taggingConfiguration); |
|
77 | 79 |
return Arc.DEFAULT_ARC; |
78 | 80 |
} |
79 | 81 |
|
80 |
private Community parseCommunity(String r) {
|
|
82 |
public Community parseCommunity(String r) {
|
|
81 | 83 |
|
82 | 84 |
try{ |
83 | 85 |
SAXReader reader = new SAXReader(); |
84 | 86 |
Document doc = reader.read(new StringReader(r)); |
85 | 87 |
Community c = new Community(); |
86 | 88 |
|
87 |
log.info("community id " + doc.valueOf("./@id"));
|
|
88 |
c.setId(doc.valueOf("./@id")); |
|
89 |
log.debug("community id " + doc.valueOf("./community/@id"));
|
|
90 |
c.setId(doc.valueOf("./community/@id"));
|
|
89 | 91 |
|
90 |
List <Node> list = doc.selectNodes("//sbj"); |
|
92 |
List <Node> list = doc.selectNodes("//subj");
|
|
91 | 93 |
final List<String> sbj = new ArrayList<>(); |
92 | 94 |
for(Node n : list){ |
93 |
log.info("text of the node " + n.getText());
|
|
95 |
log.debug("text of the node " + n.getText());
|
|
94 | 96 |
sbj.add(n.getText()); |
95 | 97 |
} |
96 | 98 |
log.info("size of the subject list " + sbj.size()); |
... | ... | |
102 | 104 |
for(Node n : list){ |
103 | 105 |
Datasource d = new Datasource(); |
104 | 106 |
|
105 |
Document dd = n.getDocument(); |
|
106 |
log.info(dd.asXML()); |
|
107 |
d.setOpenaireId(dd.selectSingleNode("./openaireId").getText()); |
|
108 |
d.setSelCriteria(dd.selectSingleNode("./selcriteria").getText()); |
|
107 |
|
|
108 |
d.setOpenaireId(n.selectSingleNode(".//openaireId").getText()); |
|
109 |
d.setSelCriteria(n.selectSingleNode(".//selcriteria").getText()); |
|
109 | 110 |
datasourceList.add(d); |
110 | 111 |
} |
111 | 112 |
if(datasourceList.size()>0) |
112 | 113 |
c.setDatasources(datasourceList); |
113 | 114 |
|
114 |
list = doc.selectNodes("//zenodocommunities");
|
|
115 |
list = doc.selectNodes("//zenodocommunity");
|
|
115 | 116 |
final List<ZenodoCommunity> zenodoCommunityList = new ArrayList<>(); |
116 | 117 |
for(Node n : list){ |
117 | 118 |
ZenodoCommunity zc = new ZenodoCommunity(); |
118 |
Document dd = n.getDocument(); |
|
119 |
zc.setZenodoCommunityId(dd.selectSingleNode("./zenodoid").getText());
|
|
120 |
zc.setSelCriteria(dd.selectSingleNode("./selcriteria").getText());
|
|
119 |
|
|
120 |
zc.setZenodoCommunityId(n.selectSingleNode("//zenodoid").getText());
|
|
121 |
zc.setSelCriteria(n.selectSingleNode(".//selcriteria").getText());
|
|
121 | 122 |
zenodoCommunityList.add(zc); |
122 | 123 |
} |
123 | 124 |
if(zenodoCommunityList.size()>0) |
Also available in: Unified diff
fixed issues