Search in sources :

Example 21 with Fundings

use of org.orcid.jaxb.model.v3.dev1.record.summary.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.v3.dev1.record.summary.PeerReviewGroup) Fundings(org.orcid.jaxb.model.v3.dev1.record.summary.Fundings) PeerReviews(org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviews) FundingGroup(org.orcid.jaxb.model.v3.dev1.record.summary.FundingGroup) Employments(org.orcid.jaxb.model.v3.dev1.record.summary.Employments) WorkGroup(org.orcid.jaxb.model.v3.dev1.record.summary.WorkGroup) WorkSummary(org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary) EducationSummary(org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary) PeerReviewSummary(org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary) Educations(org.orcid.jaxb.model.v3.dev1.record.summary.Educations) FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) EmploymentSummary(org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary) Works(org.orcid.jaxb.model.v3.dev1.record.summary.Works)

Example 22 with Fundings

use of org.orcid.jaxb.model.v3.dev1.record.summary.Fundings in project ORCID-Source by ORCID.

the class ActivitiesGroupGenerator_GroupingFundingsTest method groupFundings_DontGroupFundingsWithoutExtIds_Test.

/**
 * Test that two groups without ext ids dont get grouped
 */
@Test
public void groupFundings_DontGroupFundingsWithoutExtIds_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, FundingSummary> fundings = generateFundings();
    // Group the first group
    FundingSummary funding8 = fundings.get("funding-8");
    FundingSummary funding9 = fundings.get("funding-9");
    generator.group(funding8);
    generator.group(funding9);
    List<ActivitiesGroup> groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(2, groups.size());
    // Check there are two activities in each group
    assertEquals(1, groups.get(0).getActivities().size());
    assertEquals(1, groups.get(1).getActivities().size());
    // Check there are five external ids in each group
    assertEquals(0, groups.get(0).getGroupKeys().size());
    assertEquals(0, groups.get(1).getGroupKeys().size());
    checkActivityIsOnGroups(funding8, groups);
    checkActivityIsOnGroups(funding9, groups);
    checkActivitiesDontBelongsToTheSameGroup(groups, funding8, funding9);
}
Also used : FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) Test(org.junit.Test)

Example 23 with Fundings

use of org.orcid.jaxb.model.v3.dev1.record.summary.Fundings in project ORCID-Source by ORCID.

the class ActivitiesGroupGenerator_GroupingFundingsTest method groupFundings_1GroupsOf2Fundings_Test.

/**
 * Test grouping funding-1 and funding-2
 */
@Test
public void groupFundings_1GroupsOf2Fundings_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, FundingSummary> fundings = generateFundings();
    FundingSummary funding1 = fundings.get("funding-1");
    FundingSummary funding2 = fundings.get("funding-2");
    generator.group(funding1);
    generator.group(funding2);
    List<ActivitiesGroup> groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(1, groups.size());
    ActivitiesGroup g1 = groups.get(0);
    assertNotNull(g1);
    assertNotNull(g1.getActivities());
    assertEquals(2, g1.getActivities().size());
    assertTrue(g1.getActivities().contains(funding1));
    assertTrue(g1.getActivities().contains(funding2));
    assertNotNull(g1.getGroupKeys());
    assertEquals(5, g1.getGroupKeys().size());
    checkExternalIdentifiers(funding1, g1);
    checkExternalIdentifiers(funding2, g1);
}
Also used : FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) Test(org.junit.Test)

Example 24 with Fundings

use of org.orcid.jaxb.model.v3.dev1.record.summary.Fundings in project ORCID-Source by ORCID.

the class ActivitiesGroupGenerator_GroupingFundingsTest method groupFundings_2GroupsOf2Fundings_Test.

/**
 * Test grouping (funding-1 and funding-2) and (funding-5 and funding-6)
 */
@Test
public void groupFundings_2GroupsOf2Fundings_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, FundingSummary> fundings = generateFundings();
    FundingSummary funding1 = fundings.get("funding-1");
    FundingSummary funding2 = fundings.get("funding-2");
    FundingSummary funding5 = fundings.get("funding-5");
    FundingSummary funding6 = fundings.get("funding-6");
    generator.group(funding1);
    generator.group(funding2);
    generator.group(funding5);
    generator.group(funding6);
    List<ActivitiesGroup> groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(2, groups.size());
    // Check there are two activities in each group
    assertEquals(2, groups.get(0).getActivities().size());
    assertEquals(2, groups.get(1).getActivities().size());
    // Check there are five external ids in each group
    assertEquals(5, groups.get(0).getGroupKeys().size());
    assertEquals(5, groups.get(1).getGroupKeys().size());
    // Check each funding
    checkActivityIsOnGroups(funding1, groups);
    checkActivityIsOnGroups(funding2, groups);
    checkActivityIsOnGroups(funding5, groups);
    checkActivityIsOnGroups(funding6, groups);
    // Check funding1 and funding2 are in the same group
    checkActivitiesBelongsToTheSameGroup(groups, funding1, funding2);
    // Check funding6 and funding7 are in the same group
    checkActivitiesBelongsToTheSameGroup(groups, funding5, funding6);
    // Check fundings are not mixed
    checkActivitiesDontBelongsToTheSameGroup(groups, funding1, funding5);
    checkActivitiesDontBelongsToTheSameGroup(groups, funding1, funding6);
    checkActivitiesDontBelongsToTheSameGroup(groups, funding2, funding5);
    checkActivitiesDontBelongsToTheSameGroup(groups, funding2, funding6);
}
Also used : FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) Test(org.junit.Test)

Example 25 with Fundings

use of org.orcid.jaxb.model.v3.dev1.record.summary.Fundings in project ORCID-Source by ORCID.

the class ActivityUtilsTest method setPathToFundingsTest.

@Test
public void setPathToFundingsTest() {
    Fundings x = getFundings();
    ActivityUtils.setPathToFundings(x, ORCID);
    assertEquals("/" + ORCID + "/funding/123", x.getFundingGroup().get(0).getFundingSummary().get(0).getPath());
}
Also used : Fundings(org.orcid.jaxb.model.v3.dev1.record.summary.Fundings) Test(org.junit.Test)

Aggregations

FundingSummary (org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary)45 Test (org.junit.Test)44 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)28 EmploymentSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary)28 WorkSummary (org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)28 DistinctionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary)27 InvitedPositionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary)27 MembershipSummary (org.orcid.jaxb.model.v3.dev1.record.summary.MembershipSummary)27 PeerReviewSummary (org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary)27 QualificationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.QualificationSummary)27 ServiceSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ServiceSummary)27 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)26 Fundings (org.orcid.jaxb.model.v3.dev1.record.summary.Fundings)20 Name (org.orcid.jaxb.model.v3.dev1.record.Name)15 Address (org.orcid.jaxb.model.v3.dev1.record.Address)14 Biography (org.orcid.jaxb.model.v3.dev1.record.Biography)14 Email (org.orcid.jaxb.model.v3.dev1.record.Email)14 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)14 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)14 Person (org.orcid.jaxb.model.v3.dev1.record.Person)14