From 1bd70fa2c620492cd4abb17d40128abc447f0d8d Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Fri, 14 May 2021 11:30:41 +0200 Subject: [PATCH] preserving the old identifier among the originalIds in the doiboost construction process --- .../eu/dnetlib/doiboost/crossref/Crossref2Oaf.scala | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/crossref/Crossref2Oaf.scala b/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/crossref/Crossref2Oaf.scala index 2d5f30f73..95c5981e0 100644 --- a/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/crossref/Crossref2Oaf.scala +++ b/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/crossref/Crossref2Oaf.scala @@ -102,9 +102,16 @@ case object Crossref2Oaf { //IMPORTANT //The old method result.setId(generateIdentifier(result, doi)) - //will be replaced using IdentifierFactory - result.setId(generateIdentifier(result, doi)) - result.setId(IdentifierFactory.createIdentifier(result)) + //is replaced using IdentifierFactory, but the old identifier + //is preserved among the originalId(s) + val oldId = generateIdentifier(result, doi) + val newId = IdentifierFactory.createIdentifier(result) + + if (!oldId.equalsIgnoreCase(newId)) { + result.getOriginalId.add(oldId) + } + + result.setId(newId) // Add DataInfo result.setDataInfo(generateDataInfo())