Search in sources :

Example 56 with Funding

use of org.orcid.jaxb.model.record_rc4.Funding in project ORCID-Source by ORCID.

the class ActivityManagerImpl method fundingMap.

public LinkedHashMap<Long, Funding> fundingMap(String orcid) {
    List<Funding> fundings = profileFundingManager.getFundingList(orcid);
    LinkedHashMap<Long, Funding> fundingMap = new LinkedHashMap<>();
    if (fundings != null) {
        for (Funding funding : fundings) {
            if (funding.getVisibility().equals(Visibility.PUBLIC))
                fundingMap.put(Long.valueOf(funding.getPutCode()), funding);
        }
    }
    return fundingMap;
}
Also used : Funding(org.orcid.jaxb.model.record_v2.Funding) LinkedHashMap(java.util.LinkedHashMap)

Example 57 with Funding

use of org.orcid.jaxb.model.record_rc4.Funding in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorImpl method viewFunding.

@Override
public Response viewFunding(String orcid, Long putCode) {
    Funding f = profileFundingManagerReadOnly.getFunding(orcid, putCode);
    publicAPISecurityManagerV2.checkIsPublic(f);
    ActivityUtils.setPathToActivity(f, orcid);
    ActivityUtils.cleanEmptyFields(f);
    sourceUtilsReadOnly.setSourceName(f);
    contributorUtilsReadOnly.filterContributorPrivateData(f);
    return Response.ok(f).build();
}
Also used : Funding(org.orcid.jaxb.model.record_v2.Funding)

Example 58 with Funding

use of org.orcid.jaxb.model.record_rc4.Funding in project ORCID-Source by ORCID.

the class ActivityUtilsTest method cleanFundingTest.

@Test
public void cleanFundingTest() {
    // Test it cleans empty fields
    Funding f = getEmptyFunding();
    assertNotNull(f.getContributors().getContributor().get(0).getCreditName());
    assertNotNull(f.getContributors().getContributor().get(0).getCreditName().getContent());
    ActivityUtils.cleanEmptyFields(f);
    assertNull(f.getContributors().getContributor().get(0).getCreditName());
    // Test it doesn't remove non empty fields
    f = getEmptyFunding();
    f.getContributors().getContributor().get(0).getCreditName().setContent("test");
    assertNotNull(f.getContributors().getContributor().get(0).getCreditName());
    assertEquals("test", f.getContributors().getContributor().get(0).getCreditName().getContent());
    ActivityUtils.cleanEmptyFields(f);
    assertNotNull(f.getContributors().getContributor().get(0).getCreditName());
    assertEquals("test", f.getContributors().getContributor().get(0).getCreditName().getContent());
}
Also used : Funding(org.orcid.jaxb.model.record_v2.Funding) Test(org.junit.Test)

Example 59 with Funding

use of org.orcid.jaxb.model.record_rc4.Funding in project ORCID-Source by ORCID.

the class ActivityUtilsTest method getEmptyFunding.

private Funding getEmptyFunding() {
    Funding f = new Funding();
    FundingContributors fcs = new FundingContributors();
    FundingContributor fc = new FundingContributor();
    fc.setCreditName(new CreditName(""));
    fcs.getContributor().add(fc);
    f.setContributors(fcs);
    return f;
}
Also used : Funding(org.orcid.jaxb.model.record_v2.Funding) FundingContributor(org.orcid.jaxb.model.record_v2.FundingContributor) FundingContributors(org.orcid.jaxb.model.record_v2.FundingContributors) CreditName(org.orcid.jaxb.model.common_v2.CreditName)

Example 60 with Funding

use of org.orcid.jaxb.model.record_rc4.Funding in project ORCID-Source by ORCID.

the class SourceInActivitiesTest method getFundingWithoutExtIdentifiers.

private ProfileFundingEntity getFundingWithoutExtIdentifiers(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);
    funding = profileFundingManager.createFunding(userOrcid, funding, true);
    return profileFundingManager.getProfileFundingEntity(funding.getPutCode());
}
Also used : Funding(org.orcid.jaxb.model.record_v2.Funding) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) Title(org.orcid.jaxb.model.common_v2.Title) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle)

Aggregations

Funding (org.orcid.jaxb.model.record_v2.Funding)82 Test (org.junit.Test)73 ClientResponse (com.sun.jersey.api.client.ClientResponse)28 ArrayList (java.util.ArrayList)16 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)16 Response (javax.ws.rs.core.Response)15 DBUnitTest (org.orcid.test.DBUnitTest)15 Url (org.orcid.jaxb.model.common_v2.Url)14 Title (org.orcid.jaxb.model.common_v2.Title)11 Work (org.orcid.jaxb.model.record_v2.Work)10 List (java.util.List)9 FundingTitle (org.orcid.jaxb.model.record_v2.FundingTitle)9 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)9 Funding (org.orcid.jaxb.model.record_rc1.Funding)8 IOException (java.io.IOException)7 InputStreamReader (java.io.InputStreamReader)6 Reader (java.io.Reader)6 BaseTest (org.orcid.core.BaseTest)6 Funding (org.orcid.jaxb.model.record_rc4.Funding)6 Education (org.orcid.jaxb.model.record_v2.Education)6