use of org.orcid.jaxb.model.record_rc2.Funding in project ORCID-Source by ORCID.
the class SourceInActivitiesTest method getFunding.
private Funding getFunding(String userOrcid) {
Funding funding = new Funding();
funding.setOrganization(getOrganization());
FundingTitle title = new FundingTitle();
title.setTitle(new Title("Title " + System.currentTimeMillis()));
funding.setTitle(title);
funding.setType(org.orcid.jaxb.model.record_v2.FundingType.AWARD);
ExternalID extId = new ExternalID();
extId.setValue("111");
extId.setType(FundingExternalIdentifierType.GRANT_NUMBER.value());
extId.setUrl(new Url("http://test.com"));
extId.setRelationship(Relationship.PART_OF);
ExternalIDs extIdentifiers = new ExternalIDs();
extIdentifiers.getExternalIdentifier().add(extId);
funding.setExternalIdentifiers(extIdentifiers);
funding = profileFundingManager.createFunding(userOrcid, funding, true);
return profileFundingManager.getFunding(userOrcid, funding.getPutCode());
}
use of org.orcid.jaxb.model.record_rc2.Funding in project ORCID-Source by ORCID.
the class ProfileFundingManagerTest method testAddFundingToClaimedRecordPreserveUserDefaultVisibility.
@Test
public void testAddFundingToClaimedRecordPreserveUserDefaultVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Funding funding = getFunding(null);
funding = profileFundingManager.createFunding(claimedOrcid, funding, true);
funding = profileFundingManager.getFunding(claimedOrcid, funding.getPutCode());
assertNotNull(funding);
assertEquals("Funding title", funding.getTitle().getTitle().getContent());
assertEquals(Visibility.LIMITED, funding.getVisibility());
}
use of org.orcid.jaxb.model.record_rc2.Funding in project ORCID-Source by ORCID.
the class ProfileFundingManagerTest method getFunding.
private Funding getFunding(String grantNumber) {
Funding funding = new Funding();
ExternalIDs extIds = new ExternalIDs();
ExternalID extId = new ExternalID();
extId.setRelationship(Relationship.SELF);
extId.setType("grant_number");
extId.setUrl(new Url("http://orcid.org"));
if (grantNumber == null) {
extId.setValue("ext-id-value");
} else {
extId.setValue(grantNumber);
}
extIds.getExternalIdentifier().add(extId);
funding.setExternalIdentifiers(extIds);
FundingTitle title = new FundingTitle();
if (grantNumber == null) {
title.setTitle(new Title("Funding title"));
} else {
title.setTitle(new Title("Funding title " + grantNumber));
}
funding.setTitle(title);
Organization org = new Organization();
org.setName("org-name");
OrganizationAddress address = new OrganizationAddress();
address.setCity("city");
address.setCountry(Iso3166Country.US);
org.setAddress(address);
funding.setOrganization(org);
funding.setVisibility(Visibility.PUBLIC);
funding.setType(FundingType.AWARD);
return funding;
}
use of org.orcid.jaxb.model.record_rc2.Funding in project ORCID-Source by ORCID.
the class ProfileFundingManagerTest method testAddFundingToUnclaimedRecordPreserveFundingVisibility.
@Test
public void testAddFundingToUnclaimedRecordPreserveFundingVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Funding funding = getFunding(null);
funding = profileFundingManager.createFunding(unclaimedOrcid, funding, true);
funding = profileFundingManager.getFunding(unclaimedOrcid, funding.getPutCode());
assertNotNull(funding);
assertEquals("Funding title", funding.getTitle().getTitle().getContent());
assertEquals(Visibility.PUBLIC, funding.getVisibility());
}
use of org.orcid.jaxb.model.record_rc2.Funding in project ORCID-Source by ORCID.
the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithNoOrcidRecord.
@Test
public void testFilterContributorPrivateDataForFundingWithNoOrcidRecord() {
Funding funding = getFundingWithContributorWithoutOrcid();
contributorUtils.filterContributorPrivateData(funding);
FundingContributor contributor = funding.getContributors().getContributor().get(0);
assertNull(contributor.getContributorEmail());
assertEquals("original credit name", contributor.getCreditName().getContent());
}
Aggregations