use of org.orcid.jaxb.model.message.FundingExternalIdentifier in project ORCID-Source by ORCID.
the class T2OrcidApiServiceDelegatorTest method testAddFundingToDeprecatedAccount.
@Test(expected = OrcidDeprecatedException.class)
public void testAddFundingToDeprecatedAccount() {
SecurityContextTestUtils.setUpSecurityContext();
OrcidMessage orcidMessage = new OrcidMessage();
orcidMessage.setMessageVersion("1.2_rc6");
OrcidProfile orcidProfile = new OrcidProfile();
orcidMessage.setOrcidProfile(orcidProfile);
orcidProfile.setOrcidIdentifier(new OrcidIdentifier("4444-4444-4444-444X"));
OrcidActivities orcidActivities = new OrcidActivities();
orcidProfile.setOrcidActivities(orcidActivities);
FundingList fundings = new FundingList();
Funding funding = new Funding();
OrganizationAddress address = new OrganizationAddress();
address.setCity("City");
address.setCountry(Iso3166Country.US);
Organization org = new Organization();
org.setAddress(address);
org.setName("Testing org name");
funding.setOrganization(org);
FundingExternalIdentifiers fExtIds = new FundingExternalIdentifiers();
FundingExternalIdentifier fExtId = new FundingExternalIdentifier();
fExtId.setType(FundingExternalIdentifierType.GRANT_NUMBER);
fExtId.setValue("FExtId");
fExtIds.getFundingExternalIdentifier().add(fExtId);
funding.setFundingExternalIdentifiers(fExtIds);
funding.setType(FundingType.AWARD);
funding.setOrganizationDefinedFundingType(new OrganizationDefinedFundingSubType("fType"));
FundingTitle title = new FundingTitle();
title.setTitle(new Title("Funding title"));
funding.setTitle(title);
fundings.getFundings().add(funding);
orcidActivities.setFundings(fundings);
t2OrcidApiServiceDelegator.addFunding(mockedUriInfo, "4444-4444-4444-444X", orcidMessage);
}
use of org.orcid.jaxb.model.message.FundingExternalIdentifier in project ORCID-Source by ORCID.
the class OrcidProfileManagerImplTest method getFundingInsideOrcidProfile.
private OrcidProfile getFundingInsideOrcidProfile(String defaultTitle, String orcid) {
Funding funding = new Funding();
funding.setType(FundingType.AWARD);
FundingTitle title = new FundingTitle();
if (defaultTitle == null) {
title.setTitle(new Title("New Funding"));
} else {
title.setTitle(new Title(defaultTitle));
}
funding.setTitle(title);
FundingExternalIdentifiers fExtIds = new FundingExternalIdentifiers();
FundingExternalIdentifier fExtId = new FundingExternalIdentifier();
fExtId.setType(FundingExternalIdentifierType.GRANT_NUMBER);
if (defaultTitle == null) {
fExtId.setValue("123");
} else {
fExtId.setValue("123-" + defaultTitle);
}
fExtIds.getFundingExternalIdentifier().add(fExtId);
funding.setFundingExternalIdentifiers(fExtIds);
Organization org = new Organization();
OrganizationAddress add = new OrganizationAddress();
add.setCity("city");
add.setCountry(Iso3166Country.US);
org.setName("Test org");
org.setAddress(add);
funding.setOrganization(org);
FundingList fList = new FundingList();
fList.getFundings().add(funding);
OrcidProfile profile = new OrcidProfile();
profile.setOrcidIdentifier(orcid);
profile.setFundings(fList);
return profile;
}
use of org.orcid.jaxb.model.message.FundingExternalIdentifier in project ORCID-Source by ORCID.
the class Api12Helper method addFunding.
protected static void addFunding(String userOrcid, String token, String title, T2OAuthAPIService<ClientResponse> oauthT2Client) {
OrcidMessage orcidMessage = new OrcidMessage();
orcidMessage.setMessageVersion(OrcidMessage.DEFAULT_VERSION);
OrcidProfile orcidProfile = new OrcidProfile();
orcidMessage.setOrcidProfile(orcidProfile);
OrcidActivities orcidActivities = new OrcidActivities();
orcidProfile.setOrcidActivities(orcidActivities);
FundingList fundings = new FundingList();
Funding funding = new Funding();
funding.setVisibility(Visibility.LIMITED);
FundingTitle fundingTitle = new FundingTitle();
fundingTitle.setTitle(new Title(title));
funding.setTitle(fundingTitle);
funding.setType(FundingType.SALARY_AWARD);
Amount amount = new Amount();
amount.setCurrencyCode("CRC");
amount.setContent("1,250,000");
funding.setAmount(amount);
funding.setStartDate(new FuzzyDate(2010, 1, 1));
funding.setEndDate(new FuzzyDate(2013, 1, 1));
funding.setDescription("My Grant description");
funding.setUrl(new Url("http://url.com"));
Organization org = new Organization();
org.setName("Orcid Integration Test Org");
OrganizationAddress add = new OrganizationAddress();
add.setCity("My City");
add.setCountry(Iso3166Country.CR);
org.setAddress(add);
funding.setOrganization(org);
FundingExternalIdentifier extIdentifier = new FundingExternalIdentifier();
extIdentifier.setType(FundingExternalIdentifierType.fromValue("grant_number"));
extIdentifier.setUrl(new Url("http://url.com"));
extIdentifier.setValue("My value");
FundingExternalIdentifiers extIdentifiers = new FundingExternalIdentifiers();
extIdentifiers.getFundingExternalIdentifier().add(extIdentifier);
funding.setFundingExternalIdentifiers(extIdentifiers);
FundingContributors contributors = new FundingContributors();
FundingContributor contributor = new FundingContributor();
contributor.setCreditName(new CreditName("My Credit Name"));
contributor.setContributorEmail(new ContributorEmail("my.email@orcid-integration-test.com"));
FundingContributorAttributes attributes = new FundingContributorAttributes();
attributes.setContributorRole(FundingContributorRole.LEAD);
contributor.setContributorAttributes(attributes);
contributors.getContributor().add(contributor);
funding.setFundingContributors(contributors);
fundings.getFundings().add(funding);
orcidMessage.getOrcidProfile().getOrcidActivities().setFundings(fundings);
ClientResponse clientResponse = oauthT2Client.addFundingXml(userOrcid, orcidMessage, token);
assertEquals(201, clientResponse.getStatus());
}
Aggregations