the normalization of the content of value was not visible outside the block. Moved doi normalization operation while returning value

This commit is contained in:
Miriam Baglioni 2021-07-05 16:21:42 +02:00
parent bc34347643
commit 0892cad4e8
1 changed files with 3 additions and 4 deletions

View File

@ -83,9 +83,8 @@ object ORCIDToOAF {
JObject(extIds) <- json \ "workDetail" \"extIds"
JField("type", JString(typeValue)) <- extIds
JField("value", JString(value)) <- extIds
normalized_value: String = DoiBoostMappingUtil.normalizeDoi(value)
if "doi".equalsIgnoreCase(typeValue) && normalized_value != null
} yield (typeValue, normalized_value)
if "doi".equalsIgnoreCase(typeValue)
} yield (typeValue, DoiBoostMappingUtil.normalizeDoi(value))
if (doi.nonEmpty) {
return doi.map(l =>OrcidWork(oid, l._2))
}
@ -103,7 +102,7 @@ object ORCIDToOAF {
def convertTOOAF(input:ORCIDItem) :Publication = {
val doi = input.doi
val pub:Publication = new Publication
pub.setPid(List(createSP(doi.toLowerCase, "doi", ModelConstants.DNET_PID_TYPES)).asJava)
pub.setPid(List(createSP(doi, "doi", ModelConstants.DNET_PID_TYPES)).asJava)
pub.setDataInfo(generateDataInfo())
pub.setId(IdentifierFactory.createDOIBoostIdentifier(pub))