changed exception type, if collection indexing failes
This commit is contained in:
parent
814c908663
commit
142a296166
|
@ -350,10 +350,15 @@ public class GraphDBClient {
|
||||||
|
|
||||||
List<String> collectionResourceIds = runSPQRLQuery.selectCollectionIds(datasource, collectionId);
|
List<String> collectionResourceIds = runSPQRLQuery.selectCollectionIds(datasource, collectionId);
|
||||||
log.info(String.format("Found %d collections to index for datasource %s - %s", collectionResourceIds.size(), datasource, collectionId));
|
log.info(String.format("Found %d collections to index for datasource %s - %s", collectionResourceIds.size(), datasource, collectionId));
|
||||||
if(!collectionResourceIds.isEmpty()) {
|
try {
|
||||||
final ClassPathResource selectCollectionTemplateRes = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql");
|
if (!collectionResourceIds.isEmpty()) {
|
||||||
String selectCollectionTemplate = IOUtils.toString(selectCollectionTemplateRes.getInputStream(), StandardCharsets.UTF_8.name());
|
final ClassPathResource selectCollectionTemplateRes = new ClassPathResource("eu/dnetlib/ariadneplus/sparql/read_collection_data_template.sparql");
|
||||||
collectionIndexReport = runSPQRLQuery.executeMultipleQueryGraph(selectCollectionTemplate, collectionResourceIds, datasource, collectionId, true);
|
String selectCollectionTemplate = IOUtils.toString(selectCollectionTemplateRes.getInputStream(), StandardCharsets.UTF_8.name());
|
||||||
|
collectionIndexReport = runSPQRLQuery.executeMultipleQueryGraph(selectCollectionTemplate, collectionResourceIds, datasource, collectionId, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (RuntimeException re) {
|
||||||
|
throw new AriadnePlusPublisherException(re);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> recordIds = runSPQRLQuery.selectRecordIds(datasource, collectionId);
|
List<String> recordIds = runSPQRLQuery.selectRecordIds(datasource, collectionId);
|
||||||
|
|
|
@ -61,8 +61,7 @@ public class RunSPARQLQueryService {
|
||||||
manager.shutDown();
|
manager.shutDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String executeMultipleQueryGraph(String queryTemplate, List<String> recordIds, String datasource, String collectionId, boolean isCollection)
|
public String executeMultipleQueryGraph(String queryTemplate, List<String> recordIds, String datasource, String collectionId, boolean isCollection) {
|
||||||
throws AriadnePlusPublisherException {
|
|
||||||
if (queryTemplate==null)
|
if (queryTemplate==null)
|
||||||
return null;
|
return null;
|
||||||
final String selectQueryTemplate = queryTemplate.replaceAll("%datasource", datasource).replaceAll("%collectionId", collectionId);
|
final String selectQueryTemplate = queryTemplate.replaceAll("%datasource", datasource).replaceAll("%collectionId", collectionId);
|
||||||
|
@ -77,7 +76,7 @@ public class RunSPARQLQueryService {
|
||||||
if (operationResult!=200) {
|
if (operationResult!=200) {
|
||||||
log.error(recordId + " error_code: "+ operationResult);
|
log.error(recordId + " error_code: "+ operationResult);
|
||||||
if (isCollection) {
|
if (isCollection) {
|
||||||
throw new AriadnePlusPublisherException("Collection indexing problem - errcode: "+operationResult);
|
throw new RuntimeException("Collection indexing problem - errcode: "+operationResult);
|
||||||
}
|
}
|
||||||
int currentErrorsCount = errorCodesCount.get(0).intValue();
|
int currentErrorsCount = errorCodesCount.get(0).intValue();
|
||||||
currentErrorsCount+=1;
|
currentErrorsCount+=1;
|
||||||
|
|
Loading…
Reference in New Issue