Search in sources :

Example 46 with ActivitiesSummary

use of org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary in project ORCID-Source by ORCID.

the class BibtexManagerImpl method generateBibtexReferenceList.

@Override
public String generateBibtexReferenceList(String orcid) {
    long last = workManager.getLastModified(orcid);
    ActivitiesSummary summary = activitiesManager.getActivitiesSummary(orcid);
    List<String> citations = new ArrayList<String>();
    if (summary.getWorks() != null) {
        for (WorkGroup group : summary.getWorks().getWorkGroup()) {
            WorkSummary workSummary = group.getWorkSummary().get(0);
            Work work = workManager.getWork(orcid, workSummary.getPutCode(), last);
            String bibtex = generateBibtex(orcid, work);
            if (bibtex != null)
                citations.add(bibtex);
        }
    }
    return Joiner.on(",\n").join(citations);
}
Also used : WorkGroup(org.orcid.jaxb.model.record.summary_v2.WorkGroup) WorkSummary(org.orcid.jaxb.model.record.summary_v2.WorkSummary) ArrayList(java.util.ArrayList) Work(org.orcid.jaxb.model.record_v2.Work) ActivitiesSummary(org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary)

Example 47 with ActivitiesSummary

use of org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary in project ORCID-Source by ORCID.

the class ActivitiesSummaryManagerReadOnlyImpl method getActivitiesSummary.

public ActivitiesSummary getActivitiesSummary(String orcid, boolean justPublic) {
    long lastModifiedTime = getLastModified(orcid);
    ActivitiesSummary activities = new ActivitiesSummary();
    // Set educations
    List<EducationSummary> educationsList = affiliationsManager.getEducationSummaryList(orcid, lastModifiedTime);
    Educations educations = new Educations();
    for (EducationSummary summary : educationsList) {
        if (justPublic) {
            if (Visibility.PUBLIC.equals(summary.getVisibility())) {
                educations.getSummaries().add(summary);
            }
        } else {
            educations.getSummaries().add(summary);
        }
    }
    activities.setEducations(educations);
    // Set employments
    List<EmploymentSummary> employmentList = affiliationsManager.getEmploymentSummaryList(orcid, lastModifiedTime);
    Employments employments = new Employments();
    for (EmploymentSummary summary : employmentList) {
        if (justPublic) {
            if (Visibility.PUBLIC.equals(summary.getVisibility())) {
                employments.getSummaries().add(summary);
            }
        } else {
            employments.getSummaries().add(summary);
        }
    }
    activities.setEmployments(employments);
    // Set fundings
    List<FundingSummary> fundingSummaries = fundingManager.getFundingSummaryList(orcid, lastModifiedTime);
    Fundings fundings = fundingManager.groupFundings(fundingSummaries, justPublic);
    activities.setFundings(fundings);
    // Set peer reviews
    List<PeerReviewSummary> peerReviewSummaries = peerReviewManager.getPeerReviewSummaryList(orcid, lastModifiedTime);
    PeerReviews peerReviews = peerReviewManager.groupPeerReviews(peerReviewSummaries, justPublic);
    activities.setPeerReviews(peerReviews);
    // Set works
    List<WorkSummary> workSummaries = workManager.getWorksSummaryList(orcid, lastModifiedTime);
    Works works = workManager.groupWorks(workSummaries, justPublic);
    activities.setWorks(works);
    return activities;
}
Also used : Fundings(org.orcid.jaxb.model.record.summary_v2.Fundings) PeerReviews(org.orcid.jaxb.model.record.summary_v2.PeerReviews) ActivitiesSummary(org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary) Employments(org.orcid.jaxb.model.record.summary_v2.Employments) 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 48 with ActivitiesSummary

use of org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary in project ORCID-Source by ORCID.

the class ActivitiesSummaryManagerTest method testGetActivitiesSummary.

@Test
public void testGetActivitiesSummary() {
    ActivitiesSummary summary = activitiesSummaryManager.getActivitiesSummary(ORCID);
    assertNotNull(summary);
    assertNotNull(summary.getEducations());
    assertNotNull(summary.getEducations().getSummaries());
    assertEquals(5, summary.getEducations().getSummaries().size());
    assertNotNull(summary.getEmployments());
    assertNotNull(summary.getEmployments().getSummaries());
    assertEquals(5, summary.getEmployments().getSummaries().size());
    assertNotNull(summary.getFundings());
    assertNotNull(summary.getFundings().getFundingGroup());
    assertEquals(5, summary.getFundings().getFundingGroup().size());
    assertNotNull(summary.getPeerReviews());
    assertNotNull(summary.getPeerReviews().getPeerReviewGroup());
    assertEquals(5, summary.getPeerReviews().getPeerReviewGroup().size());
    assertNotNull(summary.getWorks());
    assertNotNull(summary.getWorks().getWorkGroup());
    assertEquals(5, summary.getWorks().getWorkGroup().size());
}
Also used : ActivitiesSummary(org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary) Test(org.junit.Test) DBUnitTest(org.orcid.test.DBUnitTest)

Example 49 with ActivitiesSummary

use of org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary in project ORCID-Source by ORCID.

the class ActivitiesSummaryManagerTest method testGetPublicActivitiesSummary.

@Test
public void testGetPublicActivitiesSummary() {
    ActivitiesSummary summary = activitiesSummaryManager.getPublicActivitiesSummary(ORCID);
    assertNotNull(summary);
    assertNotNull(summary.getEducations());
    assertNotNull(summary.getEducations().getSummaries());
    assertEquals(1, summary.getEducations().getSummaries().size());
    assertEquals(Long.valueOf(20), summary.getEducations().getSummaries().get(0).getPutCode());
    assertNotNull(summary.getEmployments());
    assertNotNull(summary.getEmployments().getSummaries());
    assertEquals(1, summary.getEmployments().getSummaries().size());
    assertEquals(Long.valueOf(17), summary.getEmployments().getSummaries().get(0).getPutCode());
    assertNotNull(summary.getFundings());
    assertNotNull(summary.getFundings().getFundingGroup());
    assertEquals(1, summary.getFundings().getFundingGroup().size());
    assertEquals(Long.valueOf(10), summary.getFundings().getFundingGroup().get(0).getFundingSummary().get(0).getPutCode());
    assertNotNull(summary.getPeerReviews());
    assertNotNull(summary.getPeerReviews().getPeerReviewGroup());
    assertEquals(1, summary.getPeerReviews().getPeerReviewGroup().size());
    assertEquals(Long.valueOf(9), summary.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getPutCode());
    assertNotNull(summary.getWorks());
    assertNotNull(summary.getWorks().getWorkGroup());
    assertEquals(1, summary.getWorks().getWorkGroup().size());
    assertEquals(Long.valueOf(11), summary.getWorks().getWorkGroup().get(0).getWorkSummary().get(0).getPutCode());
}
Also used : ActivitiesSummary(org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary) Test(org.junit.Test) DBUnitTest(org.orcid.test.DBUnitTest)

Example 50 with ActivitiesSummary

use of org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary in project ORCID-Source by ORCID.

the class OrcidSecurityManager_ActivitiesSummaryTest method testActivitiesSummary_When_AllReadLimited_And_NotSource.

@Test
public void testActivitiesSummary_When_AllReadLimited_And_NotSource() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.AFFILIATIONS_READ_LIMITED, ScopePathType.FUNDING_READ_LIMITED, ScopePathType.PEER_REVIEW_READ_LIMITED, ScopePathType.ORCID_WORKS_READ_LIMITED);
    EducationSummary e1 = createEducationSummary(Visibility.PUBLIC, CLIENT_2);
    EducationSummary e2 = createEducationSummary(Visibility.LIMITED, CLIENT_2);
    EducationSummary e3 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
    EmploymentSummary em1 = createEmploymentSummary(Visibility.PUBLIC, CLIENT_2);
    EmploymentSummary em2 = createEmploymentSummary(Visibility.LIMITED, CLIENT_2);
    EmploymentSummary em3 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
    FundingSummary f1 = createFundingSummary(Visibility.PUBLIC, CLIENT_2, EXTID_1);
    FundingSummary f2 = createFundingSummary(Visibility.LIMITED, CLIENT_2, EXTID_2);
    FundingSummary f3 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    PeerReviewSummary p1 = createPeerReviewSummary(Visibility.PUBLIC, CLIENT_2, EXTID_1);
    PeerReviewSummary p2 = createPeerReviewSummary(Visibility.LIMITED, CLIENT_2, EXTID_2);
    PeerReviewSummary p3 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    WorkSummary w1 = createWorkSummary(Visibility.PUBLIC, CLIENT_2, EXTID_1);
    WorkSummary w2 = createWorkSummary(Visibility.LIMITED, CLIENT_2, EXTID_2);
    WorkSummary w3 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    ActivitiesSummary as = new ActivitiesSummary();
    as.setEducations(createEducations(e1, e2, e3));
    as.setEmployments(createEmployments(em1, em2, em3));
    as.setFundings(createFundings(f1, f2, f3));
    as.setPeerReviews(createPeerReviews(p1, p2, p3));
    as.setWorks(createWorks(w1, w2, w3));
    orcidSecurityManager.checkAndFilter(ORCID_1, as);
    // Check it have limited Educations
    assertNotNull(as.getEducations());
    assertEquals(2, as.getEducations().getSummaries().size());
    assertTrue(as.getEducations().getSummaries().contains(e1));
    assertTrue(as.getEducations().getSummaries().contains(e2));
    assertFalse(as.getEducations().getSummaries().contains(e3));
    // Check it have limited Employments
    assertNotNull(as.getEmployments());
    assertEquals(2, as.getEmployments().getSummaries().size());
    assertTrue(as.getEmployments().getSummaries().contains(em1));
    assertTrue(as.getEmployments().getSummaries().contains(em2));
    assertFalse(as.getEmployments().getSummaries().contains(em3));
    // Check it have limited funding
    assertNotNull(as.getFundings());
    assertEquals(1, as.getFundings().getFundingGroup().size());
    assertEquals(2, as.getFundings().getFundingGroup().get(0).getActivities().size());
    assertTrue(as.getFundings().getFundingGroup().get(0).getActivities().contains(f1));
    assertTrue(as.getFundings().getFundingGroup().get(0).getActivities().contains(f2));
    assertFalse(as.getFundings().getFundingGroup().get(0).getActivities().contains(f3));
    assertEquals(3, as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertTrue(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_1)));
    assertTrue(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_2)));
    assertFalse(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_3)));
    assertTrue(as.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_SHARED)));
    // Check it have limited reviews
    assertNotNull(as.getPeerReviews());
    assertEquals(1, as.getPeerReviews().getPeerReviewGroup().size());
    assertEquals(2, as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().size());
    assertTrue(as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().contains(p1));
    assertTrue(as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().contains(p2));
    assertFalse(as.getPeerReviews().getPeerReviewGroup().get(0).getActivities().contains(p3));
    assertEquals(1, as.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertTrue(as.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_SHARED, "peer-review")));
    // Check it have limited works
    assertNotNull(as.getWorks());
    assertEquals(1, as.getWorks().getWorkGroup().size());
    assertEquals(2, as.getWorks().getWorkGroup().get(0).getActivities().size());
    assertTrue(as.getWorks().getWorkGroup().get(0).getActivities().contains(w1));
    assertTrue(as.getWorks().getWorkGroup().get(0).getActivities().contains(w2));
    assertFalse(as.getWorks().getWorkGroup().get(0).getActivities().contains(w3));
    assertEquals(3, as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertTrue(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_1)));
    assertTrue(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_2)));
    assertFalse(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_3)));
    assertTrue(as.getWorks().getWorkGroup().get(0).getIdentifiers().getExternalIdentifier().contains(getExtId(EXTID_SHARED)));
}
Also used : 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) FundingSummary(org.orcid.jaxb.model.record.summary_v2.FundingSummary) EmploymentSummary(org.orcid.jaxb.model.record.summary_v2.EmploymentSummary) ActivitiesSummary(org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)101 ActivitiesSummary (org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary)81 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)47 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)43 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)43 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)42 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)40 DBUnitTest (org.orcid.test.DBUnitTest)23 Record (org.orcid.jaxb.model.record_v2.Record)21 Person (org.orcid.jaxb.model.record_v2.Person)19 ClientResponse (com.sun.jersey.api.client.ClientResponse)18 Response (javax.ws.rs.core.Response)18 Address (org.orcid.jaxb.model.record_v2.Address)16 Email (org.orcid.jaxb.model.record_v2.Email)16 Keyword (org.orcid.jaxb.model.record_v2.Keyword)16 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)16 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)16 WorkGroup (org.orcid.jaxb.model.record.summary_v2.WorkGroup)15 OtherName (org.orcid.jaxb.model.record_v2.OtherName)14 Biography (org.orcid.jaxb.model.record_v2.Biography)13