Skip to content

Commit

Permalink
evaluate surname and given-name if authname is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
saschaszott authored May 16, 2024
1 parent 50aaec1 commit 8b5f044
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Collection<MetadatumDTO> contributeMetadata(Element element) {
}

/**
* Retrieve the the ScopusID, orcid, author name and affiliationID
* Retrieve the ScopusID, orcid, author name and affiliationID
* metadata associated with the given element object.
* If the value retrieved from the element is empty
* it is set PLACEHOLDER_PARENT_METADATA_VALUE
Expand All @@ -82,11 +82,19 @@ public Collection<MetadatumDTO> contributeMetadata(Element element) {
private List<MetadatumDTO> getMetadataOfAuthors(Element element) throws JaxenException {
List<MetadatumDTO> metadatums = new ArrayList<MetadatumDTO>();
Element authname = element.getChild("authname", NAMESPACE);
Element surname = element.getChild("surname", NAMESPACE);
Element givenName = element.getChild("given-name", NAMESPACE);
Element scopusId = element.getChild("authid", NAMESPACE);
Element orcid = element.getChild("orcid", NAMESPACE);
Element afid = element.getChild("afid", NAMESPACE);

addMetadatum(metadatums, getMetadata(getElementValue(authname), this.authname));
if (authname != null) {
addMetadatum(metadatums, getMetadata(getElementValue(authname), this.authname));
} else {
addMetadatum(metadatums, getMetadata(getElementValue(surname) + ", " +
getElementValue(givenName), this.authname));
}

addMetadatum(metadatums, getMetadata(getElementValue(scopusId), this.scopusId));
addMetadatum(metadatums, getMetadata(getElementValue(orcid), this.orcid));
addMetadatum(metadatums, getMetadata(StringUtils.isNotBlank(afid.getValue())
Expand Down Expand Up @@ -170,4 +178,4 @@ public void setAffiliation(MetadataFieldConfig affiliation) {
this.affiliation = affiliation;
}

}
}

0 comments on commit 8b5f044

Please sign in to comment.