Search in sources :

Example 36 with FundingSummary

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

the class PublicV3ApiServiceDelegatorImpl method viewFundings.

@Override
public Response viewFundings(String orcid) {
    List<FundingSummary> fundings = profileFundingManagerReadOnly.getFundingSummaryList(orcid);
    Fundings publicFundings = profileFundingManagerReadOnly.groupFundings(fundings, true);
    publicAPISecurityManagerV3.filter(publicFundings);
    ActivityUtils.setPathToFundings(publicFundings, orcid);
    Api3_0_Dev1LastModifiedDatesHelper.calculateLastModified(publicFundings);
    sourceUtilsReadOnly.setSourceName(publicFundings);
    return Response.ok(publicFundings).build();
}
Also used : Fundings(org.orcid.jaxb.model.v3.dev1.record.summary.Fundings) FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary)

Example 37 with FundingSummary

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

the class PublicV3ApiServiceDelegatorImpl method viewFundingSummary.

@Override
public Response viewFundingSummary(String orcid, Long putCode) {
    FundingSummary fs = profileFundingManagerReadOnly.getSummary(orcid, putCode);
    publicAPISecurityManagerV3.checkIsPublic(fs);
    ActivityUtils.setPathToActivity(fs, orcid);
    sourceUtilsReadOnly.setSourceName(fs);
    return Response.ok(fs).build();
}
Also used : FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary)

Example 38 with FundingSummary

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

the class ActivitiesGroupGenerator_GroupingFundingsTest method groupFundings_4GroupsOf1Funding_Test.

@Test
public void groupFundings_4GroupsOf1Funding_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, FundingSummary> fundings = generateFundings();
    // Group the first group
    // funding-2 -> C, D, E
    FundingSummary funding2 = fundings.get("funding-2");
    generator.group(funding2);
    // There should be one group, and the ext ids should be A, B and C
    List<ActivitiesGroup> groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(1, groups.size());
    ActivitiesGroup g1 = groups.get(0);
    assertNotNull(g1);
    assertNotNull(g1.getActivities());
    assertEquals(1, g1.getActivities().size());
    assertTrue(g1.getActivities().contains(funding2));
    assertNotNull(g1.getGroupKeys());
    assertEquals(3, g1.getGroupKeys().size());
    checkExternalIdentifiers(funding2, g1);
    // Add another funding to the groups
    // funding-5 -> M, N, O
    FundingSummary funding5 = fundings.get("funding-5");
    generator.group(funding5);
    // There should be two groups, one for each funding
    groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(2, groups.size());
    // There should be one activity in each group
    assertEquals(1, groups.get(0).getActivities().size());
    assertEquals(1, groups.get(1).getActivities().size());
    // There should be 3 ext ids in each group
    assertEquals(3, groups.get(0).getGroupKeys().size());
    assertEquals(3, groups.get(1).getGroupKeys().size());
    // Check funding in groups
    checkActivityIsOnGroups(funding5, groups);
    // Add another funding to the groups
    // funding-7 -> 1, 2, B
    FundingSummary funding7 = fundings.get("funding-7");
    generator.group(funding7);
    groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(3, groups.size());
    // There should be one activity in each group
    assertEquals(1, groups.get(0).getActivities().size());
    assertEquals(1, groups.get(1).getActivities().size());
    assertEquals(1, groups.get(2).getActivities().size());
    // There should be 3 ext ids in each group
    assertEquals(3, groups.get(0).getGroupKeys().size());
    assertEquals(3, groups.get(1).getGroupKeys().size());
    assertEquals(3, groups.get(2).getGroupKeys().size());
    // Check funding in groups
    checkActivityIsOnGroups(funding7, groups);
    // Add another funding to the groups
    // funding-8 -> No external identifiers
    FundingSummary funding8 = fundings.get("funding-8");
    generator.group(funding8);
    groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(4, groups.size());
    // There should be one activity in each group
    assertEquals(1, groups.get(0).getActivities().size());
    assertEquals(1, groups.get(1).getActivities().size());
    assertEquals(1, groups.get(2).getActivities().size());
    assertEquals(1, groups.get(3).getActivities().size());
    // There should be 3 ext ids in each group, except for one group that doesnt have any ext id
    boolean funding8found = false;
    for (int i = 0; i < 4; i++) {
        if (groups.get(i).getGroupKeys().size() == 0) {
            funding8found = true;
        } else {
            assertEquals(3, groups.get(i).getGroupKeys().size());
        }
    }
    assertTrue("FundingSummary without ext ids was not found", funding8found);
    // Check funding in groups
    checkActivityIsOnGroups(funding8, groups);
}
Also used : FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) Test(org.junit.Test)

Example 39 with FundingSummary

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

the class ActivitiesGroupGenerator_GroupingFundingsTest method groupFundings_MergeGroupsDontAffectNotMergedGroups_Test.

/**
 * funding-1, funding-3, funding-5 and funding-8 will be in separate groups
 * then funding-4 will merge groups of funding-1 and funding-3
 *
 * Check that after that, there are 3 groups, one with funding-1, funding-3 and funding-4, one with funding-5 and other with funding-8
 */
@Test
public void groupFundings_MergeGroupsDontAffectNotMergedGroups_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, FundingSummary> fundings = generateFundings();
    // Group the first group
    FundingSummary funding1 = fundings.get("funding-1");
    FundingSummary funding3 = fundings.get("funding-3");
    FundingSummary funding4 = fundings.get("funding-4");
    FundingSummary funding5 = fundings.get("funding-5");
    FundingSummary funding8 = fundings.get("funding-8");
    // Respect order
    generator.group(funding1);
    generator.group(funding3);
    generator.group(funding5);
    generator.group(funding8);
    generator.group(funding4);
    List<ActivitiesGroup> groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(3, groups.size());
    // Check funding1, funding3 and funding4 belongs to the same group
    checkActivitiesBelongsToTheSameGroup(groups, funding1, funding3, funding4);
    // Check funding1, funding5 and funding8 are all in different groups
    checkActivitiesDontBelongsToTheSameGroup(groups, funding1, funding5, funding8);
    checkActivityIsOnGroups(funding1, groups);
    checkActivityIsOnGroups(funding3, groups);
    checkActivityIsOnGroups(funding4, groups);
    checkActivityIsOnGroups(funding5, groups);
    checkActivityIsOnGroups(funding8, groups);
}
Also used : FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) Test(org.junit.Test)

Example 40 with FundingSummary

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

the class ActivitiesGroupGenerator_GroupingFundingsTest method groupFundings_MergeTwoGroups_Test.

/**
 * funding-1 and funding-3 will be in different groups
 * then funding-2 will go to the same group as funding-1
 * then funding-4 contains Y and B so, the two groups should be merged
 */
@Test
public void groupFundings_MergeTwoGroups_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, FundingSummary> fundings = generateFundings();
    // Group the first group
    FundingSummary funding1 = fundings.get("funding-1");
    FundingSummary funding2 = fundings.get("funding-2");
    FundingSummary funding3 = fundings.get("funding-3");
    FundingSummary funding4 = fundings.get("funding-4");
    generator.group(funding1);
    generator.group(funding2);
    generator.group(funding3);
    /**
     * At this point there are two groups
     * G1 with funding1 and funding2
     * G2 with funding3
     */
    List<ActivitiesGroup> groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(2, groups.size());
    checkActivitiesBelongsToTheSameGroup(groups, funding1, funding2);
    checkActivitiesDontBelongsToTheSameGroup(groups, funding1, funding3);
    checkActivitiesDontBelongsToTheSameGroup(groups, funding2, funding3);
    // group funding4, which should merge the two groups
    generator.group(funding4);
    groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(1, groups.size());
    assertEquals(4, groups.get(0).getActivities().size());
    assertEquals(9, groups.get(0).getGroupKeys().size());
    checkActivityIsOnGroups(funding1, groups);
    checkActivityIsOnGroups(funding2, groups);
    checkActivityIsOnGroups(funding3, groups);
    checkActivityIsOnGroups(funding4, groups);
    checkActivitiesBelongsToTheSameGroup(groups, funding1, funding2, funding3, funding4);
}
Also used : FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) Test(org.junit.Test)

Aggregations

FundingSummary (org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary)67 Test (org.junit.Test)52 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)40 EmploymentSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary)40 WorkSummary (org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)40 PeerReviewSummary (org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary)39 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)36 DistinctionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary)35 InvitedPositionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary)35 MembershipSummary (org.orcid.jaxb.model.v3.dev1.record.summary.MembershipSummary)35 QualificationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.QualificationSummary)35 ServiceSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ServiceSummary)35 Fundings (org.orcid.jaxb.model.v3.dev1.record.summary.Fundings)16 Address (org.orcid.jaxb.model.v3.dev1.record.Address)15 Email (org.orcid.jaxb.model.v3.dev1.record.Email)15 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)15 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)15 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)15 Record (org.orcid.jaxb.model.v3.dev1.record.Record)15 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)15