forked from lsmyrnaios/UrlsController
Don't base the use of id mappings on hardcoded provenance
There will be more sources that need id mappings. Just use them if defined.
This commit is contained in:
parent
b8b83e3d74
commit
be43e73e5d
|
@ -134,9 +134,9 @@ public class BulkImportServiceImpl implements BulkImportService {
|
||||||
bulkImportReport.addEvent(msg);
|
bulkImportReport.addEvent(msg);
|
||||||
fileUtils.writeToFile(bulkImportReportLocation, bulkImportReport.getJsonReport(), false);
|
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<String, String> idMappings;
|
final ConcurrentHashMap<String, String> idMappings;
|
||||||
if ( provenance.equals("springerImport") ) {
|
if ( bulkImportSource.getIdMappingFilePath() != null ) {
|
||||||
idMappings = jsonUtils.loadIdMappings(bulkImportDirName + bulkImportSource.getIdMappingFilePath(), numOfFiles, additionalLoggingMsg);
|
idMappings = jsonUtils.loadIdMappings(bulkImportDirName + bulkImportSource.getIdMappingFilePath(), numOfFiles, additionalLoggingMsg);
|
||||||
if ( idMappings == null ) {
|
if ( idMappings == null ) {
|
||||||
String errorMsg = "Could not load the file-id-mappings! As a result, the OpenAIRE-IDs cannot be generated!";
|
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();
|
String fileLocation = docFileData.getLocation();
|
||||||
FileLocationData fileLocationData = null;
|
FileLocationData fileLocationData = null;
|
||||||
String fileId;
|
String fileId;
|
||||||
if ( provenance.equals("springerImport") ) {
|
if ( idMappings != null ) {
|
||||||
String relativeFileLocation = StringUtils.replace(fileLocation, bulkImportDirName, "", 1);
|
String relativeFileLocation = StringUtils.replace(fileLocation, bulkImportDirName, "", 1);
|
||||||
if ( (fileId = idMappings.get(relativeFileLocation)) == null ) { // Take the "DOI" id matching to this file-ID.
|
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);
|
logger.error("File '" + fileLocation + "' could not have its relative-path (" + relativeFileLocation + ") mapped with an ID!" + additionalLoggingMsg);
|
||||||
|
|
Loading…
Reference in New Issue