Skip to content

Commit

Permalink
Add localKey to metadata model
Browse files Browse the repository at this point in the history
  • Loading branch information
tsande16 committed Jan 8, 2024
1 parent 85fcb7d commit 1ad3b52
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -49,10 +51,15 @@ public class NihmsMetadataSerializer implements StreamingSerializer {
private static final Logger LOG = LoggerFactory.getLogger(NihmsMetadataSerializer.class);

private DepositMetadata metadata;
private Map<String, String> funderMapping = new HashMap<>();

public NihmsMetadataSerializer(DepositMetadata metadata) {
this.metadata = metadata;
}
public NihmsMetadataSerializer(DepositMetadata metadata, Map<String, String> funderMapping) {
this.metadata = metadata;
this.funderMapping = funderMapping;
}

@Override
public SizedStream serialize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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;
}
Expand Down

0 comments on commit 1ad3b52

Please sign in to comment.