added rest method to index single record by its identifier

This commit is contained in:
Enrico Ottonello 2020-10-19 12:20:56 +02:00
parent 9174f4df14
commit 240be91c5e
3 changed files with 9 additions and 8 deletions

View File

@ -395,9 +395,10 @@ public class GraphDBClient {
return identifiers; return identifiers;
} }
public String indexOnESByIdentifiers(String datasource, String collectionId, String resourceType, List <String> identifiers) throws AriadnePlusPublisherException { public String indexOnESByIdentifier(String datasource, String collectionId, String resourceType, String identifier) throws AriadnePlusPublisherException {
String report = ""; String report = "";
try { try {
List <String> identifiers = Arrays.asList(identifier);
log.info("Start indexing from "+ datasource + " " + collectionId); log.info("Start indexing from "+ datasource + " " + collectionId);
runSPQRLQuery.setupConnection( getWriterUser(), getWriterPwd(), this.graphDBServerUrl, getRepository()); runSPQRLQuery.setupConnection( getWriterUser(), getWriterPwd(), this.graphDBServerUrl, getRepository());
runSPQRLQuery.setParser(parseRDFJSON); runSPQRLQuery.setParser(parseRDFJSON);

View File

@ -83,10 +83,10 @@ public class AriadnePlusPublisherController {
resourceType, getTarget(DEFAULT_TARGET_ENDPOINT)); resourceType, getTarget(DEFAULT_TARGET_ENDPOINT));
} }
@RequestMapping(value = "/indexOnESByIdentifiers", method = RequestMethod.POST) @RequestMapping(value = "/indexOnESByIdentifier", method = RequestMethod.POST)
public String indexOnESByIdentifiers(@RequestParam final String datasource, @RequestParam final String collectionId, public String indexOnESByIdentifier(@RequestParam final String datasource, @RequestParam final String collectionId,
@RequestParam String resourceType, @RequestParam List<String> identifiers) throws AriadnePlusPublisherException { @RequestParam String resourceType, @RequestParam String identifier) throws AriadnePlusPublisherException {
return getAriadnePlusPublisherHelper().indexOnESByIdentifiers(datasource, collectionId, return getAriadnePlusPublisherHelper().indexOnESByIdentifier(datasource, collectionId,
resourceType, identifiers, getTarget(DEFAULT_TARGET_ENDPOINT)); resourceType, identifier, getTarget(DEFAULT_TARGET_ENDPOINT));
} }
} }

View File

@ -147,8 +147,8 @@ public class AriadnePlusPublisherHelper {
return graphDBClient.selectIdentifiers(datasource, collectionId, resourceType); return graphDBClient.selectIdentifiers(datasource, collectionId, resourceType);
} }
public String indexOnESByIdentifiers(String datasource, String collectionId, String resourceType, List<String> identifiers, AriadnePlusTargets target) throws AriadnePlusPublisherException { public String indexOnESByIdentifier(String datasource, String collectionId, String resourceType, String identifier, AriadnePlusTargets target) throws AriadnePlusPublisherException {
GraphDBClient graphDBClient = this.graphdbClientFactory.getGraphDBClient(); GraphDBClient graphDBClient = this.graphdbClientFactory.getGraphDBClient();
return graphDBClient.indexOnESByIdentifiers(datasource, collectionId, resourceType, identifiers); return graphDBClient.indexOnESByIdentifier(datasource, collectionId, resourceType, identifier);
} }
} }