Revision 45126
Added by Claudio Atzori over 7 years ago
ISLookUpServiceImpl.java | ||
---|---|---|
234 | 234 |
* @see eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService#getResourceTypeSchema(java.lang.String) |
235 | 235 |
*/ |
236 | 236 |
@Override |
237 |
public String getResourceTypeSchema(final String resourceType) throws ISLookUpException { |
|
237 |
public String getResourceTypeSchema(final String resourceType) throws ISLookUpException, ISLookUpDocumentNotFoundException {
|
|
238 | 238 |
if (resourceType == null || resourceType.isEmpty()) { throw new ISLookUpException("Invalid resourceType"); } |
239 | 239 |
|
240 | 240 |
try { |
... | ... | |
252 | 252 |
* @see eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService#listCollections(java.lang.String, java.lang.String, java.lang.String) |
253 | 253 |
*/ |
254 | 254 |
@Override |
255 |
public W3CEndpointReference listCollections(final String format, final String idfatherParam, final String owner) throws ISLookUpException {
|
|
255 |
public List<String> listCollections(final String format, final String idfatherParam, final String owner) throws ISLookUpException {
|
|
256 | 256 |
String idfather = idfatherParam; // PMD |
257 | 257 |
if (idfather == null || idfather.length() == 0) { |
258 | 258 |
idfather = "InfoSpace"; |
... | ... | |
270 | 270 |
query.append("return $x"); |
271 | 271 |
} |
272 | 272 |
|
273 |
return searchProfile(query.toString());
|
|
273 |
return quickSearchProfile(query.toString());
|
|
274 | 274 |
} |
275 | 275 |
|
276 | 276 |
/** |
277 | 277 |
* {@inheritDoc} |
278 | 278 |
* |
279 |
* @see eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService#listCommunities() |
|
280 |
*/ |
|
281 |
@Override |
|
282 |
public W3CEndpointReference listCommunities() throws ISLookUpException { |
|
283 |
// TODO Auto-generated method stub |
|
284 |
return null; |
|
285 |
} |
|
286 |
|
|
287 |
/** |
|
288 |
* {@inheritDoc} |
|
289 |
* |
|
290 | 279 |
* @see eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService#listDHNIDs() |
291 | 280 |
*/ |
292 | 281 |
@Override |
... | ... | |
307 | 296 |
/** |
308 | 297 |
* {@inheritDoc} |
309 | 298 |
* |
310 |
* @see eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService#listMDStores(java.lang.String) |
|
311 |
*/ |
|
312 |
@Override |
|
313 |
public W3CEndpointReference listMDStores(final String metadataformat) throws ISLookUpException { |
|
314 |
final String fileColl = xqueryUtils.getRootCollection() + "MDStoreDSResources/MDStoreDSResourceType"; |
|
315 |
|
|
316 |
String query; |
|
317 |
if (metadataformat != null && metadataformat.length() > 0) { |
|
318 |
query = "for $x in collection('" + fileColl + "') where $x//METADATA_FORMATS/METADATA_FORMAT[@name='" + metadataformat + "'] return $x"; |
|
319 |
} else { |
|
320 |
query = "for $x in collection('" + fileColl + "') return $x"; |
|
321 |
} |
|
322 |
|
|
323 |
return searchProfile(query); |
|
324 |
} |
|
325 |
|
|
326 |
/** |
|
327 |
* {@inheritDoc} |
|
328 |
* |
|
329 |
* @see eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService#listResourceProfiles(java.lang.String, java.lang.String, java.lang.String) |
|
330 |
*/ |
|
331 |
@Override |
|
332 |
public W3CEndpointReference listResourceProfiles(final String resourceKind, final String format, final String resourceType) throws ISLookUpException { |
|
333 |
String query; // NOPMD - pmd telling nonsense here |
|
334 |
|
|
335 |
if (format != null && format.equals("short")) { |
|
336 |
query = "for $x in collection('" + xqueryUtils.getRootCollection() + resourceKind + "/" + resourceType |
|
337 |
+ "')/RESOURCE_PROFILE/HEADER/RESOURCE_IDENTIFIER/@value return $x/string()"; |
|
338 |
} else { |
|
339 |
query = "for $x in collection('" + xqueryUtils.getRootCollection() + resourceKind + "/" + resourceType + "') return $x"; |
|
340 |
} |
|
341 |
|
|
342 |
return searchProfile(query); |
|
343 |
} |
|
344 |
|
|
345 |
/** |
|
346 |
* {@inheritDoc} |
|
347 |
* |
|
348 | 299 |
* @see eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService#listResourceTypes() |
349 | 300 |
*/ |
350 | 301 |
@Override |
... | ... | |
411 | 362 |
} |
412 | 363 |
} |
413 | 364 |
|
414 |
/** |
|
415 |
* {@inheritDoc} |
|
416 |
* |
|
417 |
* @see eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService#searchProfile(java.lang.String) |
|
418 |
*/ |
|
419 |
@Override |
|
420 |
public W3CEndpointReference searchProfile(final String xquery) throws ISLookUpException { |
|
421 |
try { |
|
422 |
return isStore.searchXML(xquery); |
|
423 |
} catch (final ISStoreException e) { |
|
424 |
throw new ISLookUpException(e); |
|
425 |
} |
|
426 |
} |
|
427 |
|
|
428 | 365 |
public ResourceIdentifierResolver getResIdManager() { |
429 | 366 |
return resIdManager; |
430 | 367 |
} |
Also available in: Unified diff
migrated to dnet45, using updated mockito version in tests