diff --git a/src/main/java/eu/openaire/urls_controller/services/BulkImportServiceImpl.java b/src/main/java/eu/openaire/urls_controller/services/BulkImportServiceImpl.java index 6077937..c26e813 100644 --- a/src/main/java/eu/openaire/urls_controller/services/BulkImportServiceImpl.java +++ b/src/main/java/eu/openaire/urls_controller/services/BulkImportServiceImpl.java @@ -134,9 +134,9 @@ public class BulkImportServiceImpl implements BulkImportService { bulkImportReport.addEvent(msg); fileUtils.writeToFile(bulkImportReportLocation, bulkImportReport.getJsonReport(), false); - // If we have "provenance" = "springerImport", then we have to load the file-id-mappings. + // load the file-id-mappings if defined final ConcurrentHashMap idMappings; - if ( provenance.equals("springerImport") ) { + if ( bulkImportSource.getIdMappingFilePath() != null ) { idMappings = jsonUtils.loadIdMappings(bulkImportDirName + bulkImportSource.getIdMappingFilePath(), numOfFiles, additionalLoggingMsg); if ( idMappings == null ) { String errorMsg = "Could not load the file-id-mappings! As a result, the OpenAIRE-IDs cannot be generated!"; @@ -441,7 +441,7 @@ public class BulkImportServiceImpl implements BulkImportService { String fileLocation = docFileData.getLocation(); FileLocationData fileLocationData = null; String fileId; - if ( provenance.equals("springerImport") ) { + if ( idMappings != null ) { String relativeFileLocation = StringUtils.replace(fileLocation, bulkImportDirName, "", 1); if ( (fileId = idMappings.get(relativeFileLocation)) == null ) { // Take the "DOI" id matching to this file-ID. logger.error("File '" + fileLocation + "' could not have its relative-path (" + relativeFileLocation + ") mapped with an ID!" + additionalLoggingMsg);