Search in sources :

Example 16 with Fundings

use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegatorImpl method viewFundings.

@Override
public Response viewFundings(String orcid) {
    List<FundingSummary> fundingSummaries = profileFundingManagerReadOnly.getFundingSummaryList(orcid);
    // Lets copy the list so we don't modify the cached collection
    List<FundingSummary> filteredList = null;
    if (fundingSummaries != null) {
        filteredList = new ArrayList<FundingSummary>(fundingSummaries);
    }
    fundingSummaries = filteredList;
    orcidSecurityManager.checkAndFilter(orcid, fundingSummaries, ScopePathType.FUNDING_READ_LIMITED);
    Fundings fundings = profileFundingManager.groupFundings(fundingSummaries, false);
    ActivityUtils.setPathToFundings(fundings, orcid);
    Api2_0_LastModifiedDatesHelper.calculateLastModified(fundings);
    sourceUtils.setSourceName(fundings);
    return Response.ok(fundings).build();
}
Also used : Fundings(org.orcid.jaxb.model.record.summary_v2.Fundings) FundingSummary(org.orcid.jaxb.model.record.summary_v2.FundingSummary)

Example 17 with Fundings

use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.

the class SourceUtils method setSourceName.

public void setSourceName(ActivitiesSummary as) {
    if (as == null) {
        return;
    }
    if (as.getEducations() != null) {
        Educations educations = as.getEducations();
        List<EducationSummary> list = educations.getSummaries();
        if (list != null) {
            for (EducationSummary summary : list) {
                setSourceName(summary);
            }
        }
    }
    if (as.getEmployments() != null) {
        Employments employments = as.getEmployments();
        List<EmploymentSummary> list = employments.getSummaries();
        if (list != null) {
            for (EmploymentSummary summary : list) {
                setSourceName(summary);
            }
        }
    }
    if (as.getFundings() != null) {
        Fundings fundings = as.getFundings();
        List<FundingGroup> groups = fundings.getFundingGroup();
        if (groups != null) {
            for (FundingGroup group : groups) {
                List<FundingSummary> summaryList = group.getFundingSummary();
                if (summaryList != null) {
                    for (FundingSummary summary : summaryList) {
                        setSourceName(summary);
                    }
                }
            }
        }
    }
    if (as.getPeerReviews() != null) {
        PeerReviews peerReviews = as.getPeerReviews();
        List<PeerReviewGroup> groups = peerReviews.getPeerReviewGroup();
        if (groups != null) {
            for (PeerReviewGroup group : groups) {
                List<PeerReviewSummary> summaryList = group.getPeerReviewSummary();
                if (summaryList != null) {
                    for (PeerReviewSummary summary : summaryList) {
                        setSourceName(summary);
                    }
                }
            }
        }
    }
    if (as.getWorks() != null) {
        Works works = as.getWorks();
        List<WorkGroup> groups = works.getWorkGroup();
        if (groups != null) {
            for (WorkGroup group : groups) {
                List<WorkSummary> summaryList = group.getWorkSummary();
                if (summaryList != null) {
                    for (WorkSummary summary : summaryList) {
                        setSourceName(summary);
                    }
                }
            }
        }
    }
}
Also used : PeerReviewGroup(org.orcid.jaxb.model.record.summary_v2.PeerReviewGroup) Fundings(org.orcid.jaxb.model.record.summary_v2.Fundings) PeerReviews(org.orcid.jaxb.model.record.summary_v2.PeerReviews) FundingGroup(org.orcid.jaxb.model.record.summary_v2.FundingGroup) Employments(org.orcid.jaxb.model.record.summary_v2.Employments) WorkGroup(org.orcid.jaxb.model.record.summary_v2.WorkGroup) WorkSummary(org.orcid.jaxb.model.record.summary_v2.WorkSummary) EducationSummary(org.orcid.jaxb.model.record.summary_v2.EducationSummary) PeerReviewSummary(org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary) Educations(org.orcid.jaxb.model.record.summary_v2.Educations) FundingSummary(org.orcid.jaxb.model.record.summary_v2.FundingSummary) EmploymentSummary(org.orcid.jaxb.model.record.summary_v2.EmploymentSummary) Works(org.orcid.jaxb.model.record.summary_v2.Works)

Example 18 with Fundings

use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorTest method testGetPublicFundingsUsingToken.

@Test
public void testGetPublicFundingsUsingToken() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
    Response r = serviceDelegator.viewFundings(ORCID);
    assertNotNull(r);
    Fundings fundings = (Fundings) r.getEntity();
    assertNotNull(fundings);
    assertNotNull(fundings.getLastModifiedDate());
    assertNotNull(fundings.getLastModifiedDate().getValue());
    assertNotNull(fundings.getFundingGroup());
    assertEquals(1, fundings.getFundingGroup().size());
    assertNotNull(fundings.getFundingGroup().get(0).getIdentifiers());
    assertEquals(1, fundings.getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertEquals("http://test.orcid.org/1.com", fundings.getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getUrl().getValue());
    assertNotNull(fundings.getFundingGroup().get(0).getFundingSummary());
    assertEquals(1, fundings.getFundingGroup().get(0).getFundingSummary().size());
    assertEquals(Long.valueOf(10), fundings.getFundingGroup().get(0).getFundingSummary().get(0).getPutCode());
    assertNotNull(fundings.getFundingGroup().get(0).getFundingSummary().get(0).getLastModifiedDate());
    assertNotNull(fundings.getFundingGroup().get(0).getFundingSummary().get(0).getLastModifiedDate().getValue());
}
Also used : Response(javax.ws.rs.core.Response) Fundings(org.orcid.jaxb.model.record.summary_v2.Fundings) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 19 with Fundings

use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorTest method testGetPublicFundings.

@Test
public void testGetPublicFundings() {
    Response r = serviceDelegator.viewFundings(ORCID);
    assertNotNull(r);
    Fundings fundings = (Fundings) r.getEntity();
    assertNotNull(fundings);
    assertNotNull(fundings.getLastModifiedDate());
    assertNotNull(fundings.getLastModifiedDate().getValue());
    assertNotNull(fundings.getFundingGroup());
    assertEquals(1, fundings.getFundingGroup().size());
    assertNotNull(fundings.getFundingGroup().get(0).getIdentifiers());
    assertEquals(1, fundings.getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertEquals("http://test.orcid.org/1.com", fundings.getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getUrl().getValue());
    assertNotNull(fundings.getFundingGroup().get(0).getFundingSummary());
    assertEquals(1, fundings.getFundingGroup().get(0).getFundingSummary().size());
    assertEquals(Long.valueOf(10), fundings.getFundingGroup().get(0).getFundingSummary().get(0).getPutCode());
    assertNotNull(fundings.getFundingGroup().get(0).getFundingSummary().get(0).getLastModifiedDate());
    assertNotNull(fundings.getFundingGroup().get(0).getFundingSummary().get(0).getLastModifiedDate().getValue());
}
Also used : Response(javax.ws.rs.core.Response) Fundings(org.orcid.jaxb.model.record.summary_v2.Fundings) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 20 with Fundings

use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorTest method testViewFundings.

@Test
public void testViewFundings() {
    Response response = serviceDelegator.viewFundings(ORCID);
    assertNotNull(response);
    Fundings fundings = (Fundings) response.getEntity();
    assertNotNull(fundings);
    assertEquals("/0000-0000-0000-0003/fundings", fundings.getPath());
    assertNotNull(fundings.getLastModifiedDate());
    assertNotNull(fundings.getLastModifiedDate().getValue());
    assertEquals(1, fundings.getFundingGroup().size());
    assertEquals(1, fundings.getFundingGroup().get(0).getFundingSummary().size());
    FundingSummary funding = fundings.getFundingGroup().get(0).getFundingSummary().get(0);
    assertNotNull(funding.getTitle());
    assertNotNull(funding.getTitle().getTitle());
    assertEquals(Long.valueOf(10), funding.getPutCode());
    assertNotNull(funding.getLastModifiedDate());
    assertNotNull(funding.getLastModifiedDate().getValue());
    assertEquals("/0000-0000-0000-0003/funding/10", funding.getPath());
    assertEquals("PUBLIC", funding.getTitle().getTitle().getContent());
    assertEquals(Visibility.PUBLIC.value(), funding.getVisibility().value());
    assertEquals("APP-5555555555555555", funding.getSource().retrieveSourcePath());
}
Also used : Response(javax.ws.rs.core.Response) Fundings(org.orcid.jaxb.model.record.summary_v2.Fundings) FundingSummary(org.orcid.jaxb.model.record.summary_v2.FundingSummary) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)31 Fundings (org.orcid.jaxb.model.record.summary_v2.Fundings)24 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)19 ClientResponse (com.sun.jersey.api.client.ClientResponse)11 FundingGroup (org.orcid.jaxb.model.record.summary_v2.FundingGroup)10 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)8 Educations (org.orcid.jaxb.model.record.summary_v2.Educations)8 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)8 Employments (org.orcid.jaxb.model.record.summary_v2.Employments)8 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)8 Works (org.orcid.jaxb.model.record.summary_v2.Works)8 BaseTest (org.orcid.core.BaseTest)7 PeerReviewGroup (org.orcid.jaxb.model.record.summary_v2.PeerReviewGroup)5 Fundings (org.orcid.jaxb.model.record.summary_rc2.Fundings)4 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)4 PeerReviews (org.orcid.jaxb.model.record.summary_v2.PeerReviews)4 Address (org.orcid.jaxb.model.record_v2.Address)4 Email (org.orcid.jaxb.model.record_v2.Email)4 Keyword (org.orcid.jaxb.model.record_v2.Keyword)4 Name (org.orcid.jaxb.model.record_v2.Name)4