diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/builder/DepositSubmissionMapper.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/builder/DepositSubmissionMapper.java index b27dc21b..58db8030 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/builder/DepositSubmissionMapper.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/builder/DepositSubmissionMapper.java @@ -32,6 +32,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import org.eclipse.pass.deposit.DepositServiceRuntimeException; +import org.eclipse.pass.deposit.config.repository.RepositoryConfig; import org.eclipse.pass.deposit.model.DepositFile; import org.eclipse.pass.deposit.model.DepositFileType; import org.eclipse.pass.deposit.model.DepositManifest; @@ -196,6 +197,7 @@ private DepositMetadata.Grant createGrant(User userEntity, Grant grantEntity) { grant.setGrantId(grantEntity.getAwardNumber()); grant.setGrantPi(createPerson(userEntity, DepositMetadata.PERSON_TYPE.pi)); grant.setFunder(grantEntity.getPrimaryFunder().getName()); + grant.setFunderLocalKey(grantEntity.getLocalKey()); return grant; } diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/provider/nihms/NihmsMetadataSerializer.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/provider/nihms/NihmsMetadataSerializer.java index 247100d3..8b937b7b 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/provider/nihms/NihmsMetadataSerializer.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/provider/nihms/NihmsMetadataSerializer.java @@ -20,7 +20,9 @@ import java.time.LocalDate; import java.time.Period; import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; @@ -49,10 +51,15 @@ public class NihmsMetadataSerializer implements StreamingSerializer { private static final Logger LOG = LoggerFactory.getLogger(NihmsMetadataSerializer.class); private DepositMetadata metadata; + private Map funderMapping = new HashMap<>(); public NihmsMetadataSerializer(DepositMetadata metadata) { this.metadata = metadata; } + public NihmsMetadataSerializer(DepositMetadata metadata, Map funderMapping) { + this.metadata = metadata; + this.funderMapping = funderMapping; + } @Override public SizedStream serialize() { diff --git a/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/provider/nihms/NihmsMetadataSerializerTest.java b/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/provider/nihms/NihmsMetadataSerializerTest.java index eb0bafd7..f3f0bce2 100644 --- a/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/provider/nihms/NihmsMetadataSerializerTest.java +++ b/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/provider/nihms/NihmsMetadataSerializerTest.java @@ -146,16 +146,26 @@ public void setup() throws Exception { DepositMetadata.Grant grant1 = new DepositMetadata.Grant(); grant1.setGrantId("R0123456789"); - grant1.setFunder("nih"); + grant1.setFunder("FOGARTY INTERNATIONAL CENTER"); + grant1.setFunderLocalKey("johnshopkins.edu:funder:300484"); grant1.setGrantPi(person1); grantList.add(grant1); DepositMetadata.Grant grant2 = new DepositMetadata.Grant(); grant2.setGrantId("R0123456000"); - grant2.setFunder("nih"); + grant2.setFunder("CENTERS FOR DISEASE CONTROL"); + grant2.setFunderLocalKey("johnshopkins.edu:funder:300293"); grant2.setGrantPi(person2); grantList.add(grant2); + DepositMetadata.Grant grant3 = new DepositMetadata.Grant(); + grant2.setGrantId("R0123456897"); + grant2.setFunder("MYRIAD GENETICS INC"); + grant2.setFunderLocalKey("johnshopkins.edu:funder:301885"); + grant2.setGrantPi(person2); + grantList.add(grant2); + + metadata.setJournalMetadata(journal); metadata.setManuscriptMetadata(manuscript); metadata.setPersons(personList); diff --git a/pass-deposit-services/deposit-model/src/main/java/org/eclipse/pass/deposit/model/DepositMetadata.java b/pass-deposit-services/deposit-model/src/main/java/org/eclipse/pass/deposit/model/DepositMetadata.java index e3be938f..f95ff630 100644 --- a/pass-deposit-services/deposit-model/src/main/java/org/eclipse/pass/deposit/model/DepositMetadata.java +++ b/pass-deposit-services/deposit-model/src/main/java/org/eclipse/pass/deposit/model/DepositMetadata.java @@ -545,6 +545,7 @@ public static class Grant { //this is the grant awardNumber in PASS String grantId; String funder; + String funderLocalKey; Person grantPi; public String getGrantId() { @@ -563,6 +564,14 @@ public void setFunder(String funder) { this.funder = funder; } + public String getFunderLocalKey() { + return funderLocalKey; + } + + public void setFunderLocalKey(String funderLocalKey) { + this.funderLocalKey = funderLocalKey; + } + public Person getGrantPi() { return grantPi; }