Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add commonName and reference in ExternalIdentifiersSummary #6863

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

public class ExternalIdentifiersSummary {
private String id;
private String commonName;
private String reference;
private String url;
private boolean validated;

Expand All @@ -21,6 +23,22 @@ public void setId(String id) {
this.id = id;
}

public String getCommonName() {
return commonName;
}

public void setCommonName(String commonName) {
this.commonName = commonName;
}

public String getReference() {
return reference;
}

public void setReference(String reference) {
this.reference = reference;
}

public String getUrl() {
return url;
}
Expand Down Expand Up @@ -51,6 +69,14 @@ public static ExternalIdentifiersSummary valueOf(PersonExternalIdentifier person
ExternalIdentifiersSummary form = new ExternalIdentifiersSummary();

if (personExternalIdentifier != null) {
if (!PojoUtil.isEmpty(personExternalIdentifier.getType())) {
form.setCommonName(personExternalIdentifier.getType());
}

if (!PojoUtil.isEmpty(personExternalIdentifier.getValue())) {
form.setReference(personExternalIdentifier.getValue());
}

if (!PojoUtil.isEmpty(personExternalIdentifier.getUrl())) {
form.setUrl(personExternalIdentifier.getUrl().getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,20 @@ public void testGetRecordSummary() {

// Added by member
assertEquals(String.valueOf(19), record.getExternalIdentifiers().get(0).getId());
assertEquals("self_public_user_obo_type", record.getExternalIdentifiers().get(0).getCommonName());
assertEquals("self_public_user_obo_ref", record.getExternalIdentifiers().get(0).getReference());
assertEquals("http://ext-id/self/obo/public", record.getExternalIdentifiers().get(0).getUrl());
assertFalse(record.getExternalIdentifiers().get(0).isValidated());
// Added by user
assertEquals(String.valueOf(18), record.getExternalIdentifiers().get(1).getId());
assertEquals("self_public_type", record.getExternalIdentifiers().get(1).getCommonName());
assertEquals("self_public_ref", record.getExternalIdentifiers().get(1).getReference());
assertEquals("http://ext-id/self/public", record.getExternalIdentifiers().get(1).getUrl());
assertFalse(record.getExternalIdentifiers().get(1).isValidated());
// User OBO
assertEquals(String.valueOf(13), record.getExternalIdentifiers().get(2).getId());
assertEquals("public_type", record.getExternalIdentifiers().get(2).getCommonName());
assertEquals("public_ref", record.getExternalIdentifiers().get(2).getReference());
assertEquals("http://ext-id/public_ref", record.getExternalIdentifiers().get(2).getUrl());
assertTrue(record.getExternalIdentifiers().get(2).isValidated());

Expand Down