From 7364c3cbb57a509257116d85b3ac2d9cb7d78640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Garc=C3=ADa?= Date: Tue, 5 Dec 2023 16:19:17 +0100 Subject: [PATCH] Ingester / Remove initialisation of the GeoNetwork client (not used) --- .../ingester/service/IngesterService.java | 55 ------------------- 1 file changed, 55 deletions(-) diff --git a/services/ingester/src/main/java/com/geocat/ingester/service/IngesterService.java b/services/ingester/src/main/java/com/geocat/ingester/service/IngesterService.java index 3a518a7..ebcdbd5 100644 --- a/services/ingester/src/main/java/com/geocat/ingester/service/IngesterService.java +++ b/services/ingester/src/main/java/com/geocat/ingester/service/IngesterService.java @@ -8,7 +8,6 @@ import com.geocat.ingester.dao.ingester.IngestJobRepo; import com.geocat.ingester.dao.linkchecker.*; import com.geocat.ingester.exception.GeoNetworkClientException; -import com.geocat.ingester.geonetwork.client.GeoNetworkClient; import com.geocat.ingester.model.harvester.EndpointJob; import com.geocat.ingester.model.harvester.HarvestJob; import com.geocat.ingester.model.harvester.MetadataRecordXml; @@ -49,9 +48,6 @@ public class IngesterService { @Autowired private CatalogueService catalogueService; - @Autowired - private GeoNetworkClient geoNetworkClient; - @Autowired private IngestJobService ingestJobService; @@ -201,13 +197,6 @@ public boolean run(String processId, String harvestJobId) throws Exception { return false; } - // Index added/updated records - // TODO: Test, commented to be indexed in GeoNetwork to avoid issues with GeoNetwork API and ECAS - List metadataIdsToIndex = metadataIds.entrySet().stream().filter(a -> a.getValue().equals(Boolean.TRUE)) - .map(Map.Entry::getKey) - .collect(Collectors.toList()); - geoNetworkClient.init(); - if (!continueProcessing(processId)) { log.warn(harvestJobId + " is in USERABORT/ERROR state - aborting"); return false; @@ -253,50 +242,6 @@ public boolean run(String processId, String harvestJobId) throws Exception { return true; } - - /** - * Calls GeoNetwork index process for a set of metadata records. - * - * @param metadataIds - * @param processId - * @return true - completed, false - aborted - * @throws GeoNetworkClientException - */ - private boolean indexRecords(List metadataIds, String processId) { - int batchSize = 50; - - int totalPages = (int) Math.ceil(metadataIds.size() * 1.0 / batchSize * 1.0); - - int total = 0; - - for (int i = 0; i < totalPages; i++) { - try { - if (!continueProcessing(processId)) { - log.warn(processId + " is in USERABORT/ERROR state - aborting"); - return false; - } - - int from = i * batchSize; - int to = Math.min(((i + 1) * batchSize), metadataIds.size()); - - int toR = (i == totalPages - 1) ? metadataIds.size() : (to - 1); - log.info("Indexing harvested metadata records from " + Math.max(1, i * batchSize) + " to " + toR + " of " + metadataIds.size()); - - geoNetworkClient.index(metadataIds.subList(from, to)); - - total = total + (to - from); - - ingestJobService.updateIngestJobStateInDBIndexedRecords(processId, total); - - } catch (GeoNetworkClientException ex) { - // TODO: Handle exception - log.error(ex.getMessage(), ex); - return false; - } - } - return true; - } - /** * Calls GeoNetwork delete process for a set of metadata records. *