From 1b9097a595f2b586742525fda21a4fd6caa535a0 Mon Sep 17 00:00:00 2001 From: "c.dumitru@orcid.org" Date: Thu, 23 Feb 2023 15:26:41 +0000 Subject: [PATCH] Fixed the relationship for the same external identifiers with different relationships for works --- .../org/orcid/core/cli/anonymize/AnonymizeText.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/orcid-core/src/main/java/org/orcid/core/cli/anonymize/AnonymizeText.java b/orcid-core/src/main/java/org/orcid/core/cli/anonymize/AnonymizeText.java index 59816904dda..ea28eb8ed9f 100644 --- a/orcid-core/src/main/java/org/orcid/core/cli/anonymize/AnonymizeText.java +++ b/orcid-core/src/main/java/org/orcid/core/cli/anonymize/AnonymizeText.java @@ -107,7 +107,11 @@ public ExternalID anonymizeWorkExternalIdentifier(JSONObject original) throws Ma ExternalID wExtId = new ExternalID(); if (extIdKey != null) { if (extIdsAnonymized.get(extIdKey) != null) { - return extIdsAnonymized.get(extIdKey); + wExtId = extIdsAnonymized.get(extIdKey); + if (original.has(KEY_RELATIONSHIP)) { + wExtId.setRelationship(Relationship.valueOf(original.getString(KEY_RELATIONSHIP))); + } + return wExtId; } } if (workIdentifierType != null) { @@ -154,7 +158,11 @@ public ExternalID anonymizeWorkExternalIdentifier(ExternalID original) throws Ma ExternalID wExtId = new ExternalID(); if (extIdKey != null) { if (extIdsAnonymized.get(extIdKey) != null) { - return extIdsAnonymized.get(extIdKey); + wExtId = extIdsAnonymized.get(extIdKey); + if (original.getRelationship() != null) { + wExtId.setRelationship(original.getRelationship()); + } + return wExtId; } }