Search in sources :

Example 31 with WorkSummary

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

the class PublicV3ApiServiceDelegatorImpl method viewWorkSummary.

@Override
public Response viewWorkSummary(String orcid, Long putCode) {
    WorkSummary ws = workManagerReadOnly.getWorkSummary(orcid, putCode);
    ActivityUtils.cleanEmptyFields(ws);
    publicAPISecurityManagerV3.checkIsPublic(ws);
    ActivityUtils.setPathToActivity(ws, orcid);
    sourceUtilsReadOnly.setSourceName(ws);
    return Response.ok(ws).build();
}
Also used : WorkSummary(org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)

Example 32 with WorkSummary

use of org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary 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 33 with WorkSummary

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

the class ActivitiesGroupGenerator_GroupingWorksTest method groupWorks_2GroupsOf2Works_Test.

/**
 * Test grouping (work-1 and work-2) and (work-6 and work-7)
 */
@Test
public void groupWorks_2GroupsOf2Works_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, WorkSummary> works = generateWorks();
    WorkSummary work1 = works.get("work-1");
    WorkSummary work2 = works.get("work-2");
    WorkSummary work6 = works.get("work-6");
    WorkSummary work7 = works.get("work-7");
    generator.group(work1);
    generator.group(work2);
    generator.group(work6);
    generator.group(work7);
    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 work
    checkActivityIsOnGroups(work1, groups);
    checkActivityIsOnGroups(work2, groups);
    checkActivityIsOnGroups(work6, groups);
    checkActivityIsOnGroups(work7, groups);
    // Check work1 and work2 are in the same group
    checkActivitiesBelongsToTheSameGroup(groups, work1, work2);
    // Check work6 and work7 are in the same group
    checkActivitiesBelongsToTheSameGroup(groups, work6, work7);
    // Check works are not mixed
    checkActivitiesDontBelongsToTheSameGroup(groups, work1, work6);
    checkActivitiesDontBelongsToTheSameGroup(groups, work1, work7);
    checkActivitiesDontBelongsToTheSameGroup(groups, work2, work6);
    checkActivitiesDontBelongsToTheSameGroup(groups, work2, work7);
}
Also used : WorkSummary(org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary) TransientNonEmptyString(org.orcid.jaxb.model.v3.dev1.common.TransientNonEmptyString) Test(org.junit.Test)

Example 34 with WorkSummary

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

the class ActivitiesGroupGenerator_GroupingWorksTest method testNormalizedGrouping.

@Test
public void testNormalizedGrouping() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    List<WorkSummary> sums = new ArrayList<WorkSummary>();
    for (int i = 0; i < 2; i++) {
        String title = "work-" + i;
        WorkSummary work = new WorkSummary();
        // Set title
        WorkTitle workTitle = new WorkTitle();
        workTitle.setTitle(new Title(title));
        work.setTitle(workTitle);
        ExternalIDs wei = new ExternalIDs();
        ExternalID e1 = new ExternalID();
        e1.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
        e1.setValue("a");
        e1.setNormalized(new TransientNonEmptyString("a"));
        wei.getExternalIdentifier().add(e1);
        work.setExternalIdentifiers(wei);
        sums.add(work);
    }
    sums.get(0).getExternalIdentifiers().getExternalIdentifier().get(0).setValue("A");
    generator.group(sums.get(0));
    generator.group(sums.get(1));
    assertEquals(1, generator.getGroups().size());
    checkActivitiesBelongsToTheSameGroup(generator.getGroups(), sums.get(0), sums.get(1));
    for (int i = 2; i < 4; i++) {
        String title = "work-" + i;
        WorkSummary work = new WorkSummary();
        // Set title
        WorkTitle workTitle = new WorkTitle();
        workTitle.setTitle(new Title(title));
        work.setTitle(workTitle);
        ExternalIDs wei = new ExternalIDs();
        ExternalID e1 = new ExternalID();
        e1.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
        e1.setValue("https://dx.doi.org/10/UPPER");
        e1.setNormalized(new TransientNonEmptyString("10/upper"));
        wei.getExternalIdentifier().add(e1);
        work.setExternalIdentifiers(wei);
        sums.add(work);
    }
    sums.get(0).getExternalIdentifiers().getExternalIdentifier().get(0).setValue("http://doi.org/10/upper");
    generator.group(sums.get(2));
    generator.group(sums.get(3));
    assertEquals(2, generator.getGroups().size());
    checkActivitiesBelongsToTheSameGroup(generator.getGroups(), sums.get(0), sums.get(1));
    checkActivitiesBelongsToTheSameGroup(generator.getGroups(), sums.get(2), sums.get(3));
}
Also used : WorkSummary(org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary) ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) ArrayList(java.util.ArrayList) Title(org.orcid.jaxb.model.v3.dev1.common.Title) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) TransientNonEmptyString(org.orcid.jaxb.model.v3.dev1.common.TransientNonEmptyString) TransientNonEmptyString(org.orcid.jaxb.model.v3.dev1.common.TransientNonEmptyString) Test(org.junit.Test)

Example 35 with WorkSummary

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

the class ActivitiesGroupGenerator_GroupingWorksTest method groupWorks_1GroupsOf2Works_Test.

/**
 * Test grouping work-1 and work-2
 */
@Test
public void groupWorks_1GroupsOf2Works_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, WorkSummary> works = generateWorks();
    WorkSummary work1 = works.get("work-1");
    WorkSummary work2 = works.get("work-2");
    generator.group(work1);
    generator.group(work2);
    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(work1));
    assertTrue(g1.getActivities().contains(work2));
    assertNotNull(g1.getGroupKeys());
    assertEquals(5, g1.getGroupKeys().size());
    checkExternalIdentifiers(work1, g1);
    checkExternalIdentifiers(work2, g1);
}
Also used : WorkSummary(org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary) TransientNonEmptyString(org.orcid.jaxb.model.v3.dev1.common.TransientNonEmptyString) Test(org.junit.Test)

Aggregations

WorkSummary (org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)85 Test (org.junit.Test)64 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)42 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)40 EmploymentSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary)40 FundingSummary (org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary)40 PeerReviewSummary (org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary)39 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 WorkGroup (org.orcid.jaxb.model.v3.dev1.record.summary.WorkGroup)27 Works (org.orcid.jaxb.model.v3.dev1.record.summary.Works)23 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