Skip to content

Commit

Permalink
Add the code to handle the positionName on the creator.
Browse files Browse the repository at this point in the history
  • Loading branch information
taojing2002 committed May 30, 2019
1 parent 8873651 commit a0af1db
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ private void appendCreators(Subject subject, DataPackage emlPackage, Document do
boolean found = false;
for(Party party : parties) {
String surName = party.getSurName();
String positionName = party.getPositionName();
String organization = party.getOrganization();
String fullName = null;
if(surName != null && !surName.trim().equals("")) {
Expand All @@ -210,13 +211,15 @@ private void appendCreators(Subject subject, DataPackage emlPackage, Document do
//System.out.println("the surname ============== "+surName);
fullName = surName;
if(givenNames!=null && givenNames.size() > 0 && givenNames.get(0) != null && !givenNames.get(0).trim().equals("")) {
fullName = fullName +nameSep+givenNames.get(0);
fullName = fullName + nameSep + givenNames.get(0);
}
} else if(positionName != null && !positionName.trim().equals("")) {
//it has a positionName and we will use the positionName as the full name (it doesn't have the individual name)
fullName = positionName;
} else {
//organization name
//System.out.println("the organziation name ============== "+organization);
fullName=organization; //organization is the creator.
organization = null; //affilication is null
organization = null; //affiliation is null
}
String nameIdentifier = null;
String nameIdentifierSchemeURI = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public class EML2DataCiteFactoryTest extends D1NodeServiceTest {

public static final String section = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
public static final String section0 = "<resource xmlns=\"http://datacite.org/schema/kernel-3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://datacite.org/schema/kernel-3 https://schema.datacite.org/meta/kernel-3.1/metadata.xsd\"><identifier identifierType=\"DOI\">";
public static final String section1 = "</identifier><creators><creator><creatorName>Lehman, Clarence</creatorName></creator><creator><creatorName>Inouye, Richard</creatorName><nameIdentifier nameIdentifierScheme=\"ORCID\" schemeURI=\"http://orcid.org/\">0001-0005-9751-1234</nameIdentifier></creator><creator><creatorName>Idaho State University</creatorName><nameIdentifier nameIdentifierScheme=\"ORCID\" schemeURI=\"http://orcid.org/\">0001-0005-9751-1111</nameIdentifier></creator><creator><creatorName>Smith, Mike</creatorName><nameIdentifier nameIdentifierScheme=\"ORCID\" schemeURI=\"https://orcid.org/\">0001-0005-9751-6987</nameIdentifier><affiliation>National Center for Ecological Analysis and Synthesis</affiliation></creator><creator><creatorName>Ed, John</creatorName><nameIdentifier nameIdentifierScheme=\"ORCID\" schemeURI=\"https://orcid.org/\">0001-0005-9751-0000</nameIdentifier><affiliation>NCREAS</affiliation></creator></creators><titles><title xml:lang=\"en\">Data from Cedar Creek LTER on productivity and species richness";
public static final String section1 = "</identifier><creators><creator><creatorName>Lehman, Clarence</creatorName></creator><creator><creatorName>Inouye, Richard</creatorName><nameIdentifier nameIdentifierScheme=\"ORCID\" schemeURI=\"http://orcid.org/\">0001-0005-9751-1234</nameIdentifier></creator><creator><creatorName>Idaho State University</creatorName><nameIdentifier nameIdentifierScheme=\"ORCID\" schemeURI=\"http://orcid.org/\">0001-0005-9751-1111</nameIdentifier></creator><creator>" +
"<creatorName>Smith, Mike</creatorName><nameIdentifier nameIdentifierScheme=\"ORCID\" schemeURI=\"https://orcid.org/\">0001-0005-9751-6987</nameIdentifier><affiliation>National Center for Ecological Analysis and Synthesis</affiliation></creator><creator><creatorName>Ed, John</creatorName><nameIdentifier nameIdentifierScheme=\"ORCID\" schemeURI=\"https://orcid.org/\">0001-0005-9751-0000</nameIdentifier><affiliation>NCEAS</affiliation></creator>" +
"<creator><creatorName>Data manager</creatorName><affiliation>NCEAS, University of California</affiliation></creator></creators><titles><title xml:lang=\"en\">Data from Cedar Creek LTER on productivity and species richness";
public static final String section2 = "for use in a workshop titled \"An Analysis of the Relationship between";
public static final String section3 = "Productivity and Diversity using Experimental Results from the Long-Term";
public static final String section4 = "Ecological Research Network\" held at NCEAS in September 1996.</title></titles><publisher>Jefferson, John. Director. Institute of Ecology";
Expand Down
6 changes: 5 additions & 1 deletion test/eml-datacite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<givenName>John</givenName>
<surName>Ed</surName>
</individualName>
<organizationName>NCREAS</organizationName>
<organizationName>NCEAS</organizationName>
<address>
<deliveryPoint>735 State St., Suite 300</deliveryPoint>
<city>Santa Barbara</city>
Expand All @@ -85,6 +85,10 @@
<electronicMailAddress>[email protected]</electronicMailAddress>
<userId directory="https://orcid.org/">https://orcid.org/0001-0005-9751-0000</userId>
</creator>
<creator id="8176318666062453">
<positionName>Data manager</positionName>
<organizationName>NCEAS, University of California</organizationName>
</creator>
<pubDate>2009-01-02</pubDate>
<abstract>
<para>
Expand Down

0 comments on commit a0af1db

Please sign in to comment.