Revision 52982
Added by Andreas Czerniak over 5 years ago
RestIterator.java | ||
---|---|---|
153 | 153 |
String nextQuery = ""; |
154 | 154 |
String emptyXml = "<"+wrapName+"></"+wrapName+">"; |
155 | 155 |
Node resultNode = null; |
156 |
NodeList nodeList; |
|
156 |
NodeList nodeList = null; |
|
157 |
int discoverResultSize = 0; |
|
157 | 158 |
|
158 | 159 |
try { |
159 | 160 |
resultStream = new URL(query).openStream(); |
... | ... | |
175 | 176 |
if (!(emptyXml.toLowerCase()).equals(resultXml.toLowerCase())) { |
176 | 177 |
resultNode = (Node) xpath.evaluate("/", new InputSource(resultStream), XPathConstants.NODE); |
177 | 178 |
nodeList = (NodeList) xprEntity.evaluate(resultNode, XPathConstants.NODESET); |
178 |
log.debug("nodeList length: " + nodeList.getLength());
|
|
179 |
log.debug("nodeList.length: " + nodeList.getLength());
|
|
179 | 180 |
for (int i = 0; i < nodeList.getLength(); i++) { |
180 | 181 |
StringWriter sw = new StringWriter(); |
181 | 182 |
transformer.transform(new DOMSource(nodeList.item(i)), new StreamResult(sw)); |
182 | 183 |
recordQueue.add(sw.toString()); |
183 | 184 |
} |
184 |
} |
|
185 |
} else { log.info("resultXml is equal with emptyXml"); } |
|
186 |
|
|
185 | 187 |
resumptionInt += resultSizeValue; |
186 | 188 |
|
187 | 189 |
/* replaced by switch statement as follow |
... | ... | |
199 | 201 |
|
200 | 202 |
case "discover": // length of results unknown |
201 | 203 |
if( (emptyXml.toLowerCase()).equals(resultXml.toLowerCase()) ) { |
202 |
resumptionStr = ""; |
|
203 |
resultTotal = resumptionInt;
|
|
204 |
// resumptionStr = "";
|
|
205 |
resultTotal = discoverResultSize;
|
|
204 | 206 |
} else { |
205 | 207 |
resumptionStr = Integer.toString(resumptionInt); |
206 | 208 |
resultTotal = resumptionInt+1; |
209 |
if(nodeList != null) { discoverResultSize += nodeList.getLength(); } |
|
207 | 210 |
} |
211 |
log.info("discoverResultSize: " + discoverResultSize); |
|
208 | 212 |
break; |
209 | 213 |
|
210 | 214 |
default: // otherwise: abort |
211 |
resultTotal = resumptionInt; |
|
215 |
// resultTotal = resumptionInt;
|
|
212 | 216 |
break; |
213 | 217 |
} |
214 | 218 |
|
Also available in: Unified diff
Additional comments, debugging output in the Rest_Json CollectorPlugin for the enhancements of the new OpenDOAR API at JISC under https://v2.sherpa.ac.uk/opendoar/