fix: preserving the old identifier among the originalIds in the doiboost construction process, trying to avoid UnsupportedOperationException while adding elements to the originalIds

This commit is contained in:
Claudio Atzori 2021-05-19 16:01:52 +02:00
parent ba03f549d7
commit c4a23c2f4d
1 changed files with 5 additions and 2 deletions

View File

@ -17,6 +17,8 @@ import scala.collection.mutable
import scala.util.matching.Regex
import eu.dnetlib.dhp.schema.scholexplorer.OafUtils
import java.util
case class CrossrefDT(doi: String, json:String, timestamp: Long) {}
case class mappingAffiliation(name: String) {}
@ -96,7 +98,8 @@ case object Crossref2Oaf {
val alternativeIds = for (JString(ids) <- json \ "alternative-id") yield ids
val tmp = clinicalTrialNumbers ::: alternativeIds ::: List(doi)
result.setOriginalId(tmp.filter(id => id != null).asJava)
val originalIds = new util.ArrayList(tmp.filter(id => id != null).asJava)
result.setOriginalId(originalIds)
// Add DataInfo
result.setDataInfo(generateDataInfo())
@ -212,7 +215,7 @@ case object Crossref2Oaf {
}
result.setId(newId)
if (result.getId== null)
if (result.getId == null)
null
else
result