Skip to content

Commit 70964ce

Browse files
authored
Merge pull request #6738 from ORCID/8378-anonymizeqa-script-to-anonymize-data-identifier-relationship-types-should-persist-as-per-origi
Fixed the relationship for the same external identifiers with different relationships for various works
2 parents f1bc33f + 1b9097a commit 70964ce

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

orcid-core/src/main/java/org/orcid/core/cli/anonymize/AnonymizeText.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ public ExternalID anonymizeWorkExternalIdentifier(JSONObject original) throws Ma
107107
ExternalID wExtId = new ExternalID();
108108
if (extIdKey != null) {
109109
if (extIdsAnonymized.get(extIdKey) != null) {
110-
return extIdsAnonymized.get(extIdKey);
110+
wExtId = extIdsAnonymized.get(extIdKey);
111+
if (original.has(KEY_RELATIONSHIP)) {
112+
wExtId.setRelationship(Relationship.valueOf(original.getString(KEY_RELATIONSHIP)));
113+
}
114+
return wExtId;
111115
}
112116
}
113117
if (workIdentifierType != null) {
@@ -154,7 +158,11 @@ public ExternalID anonymizeWorkExternalIdentifier(ExternalID original) throws Ma
154158
ExternalID wExtId = new ExternalID();
155159
if (extIdKey != null) {
156160
if (extIdsAnonymized.get(extIdKey) != null) {
157-
return extIdsAnonymized.get(extIdKey);
161+
wExtId = extIdsAnonymized.get(extIdKey);
162+
if (original.getRelationship() != null) {
163+
wExtId.setRelationship(original.getRelationship());
164+
}
165+
return wExtId;
158166
}
159167
}
160168

0 commit comments

Comments
 (0)