Skip to content

Commit

Permalink
fix: Add commonName and reference in ExternalIdentifiersSummary
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielPalafox committed Aug 10, 2023
1 parent c1d7cdd commit 8800e81
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
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

0 comments on commit 8800e81

Please sign in to comment.