Search in sources :

Example 16 with PeerReviewSummary

use of org.orcid.jaxb.model.record.summary_rc2.PeerReviewSummary in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegatorImpl method viewPeerReviewSummary.

@Override
public Response viewPeerReviewSummary(String orcid, Long putCode) {
    PeerReviewSummary ps = peerReviewManagerReadOnly.getPeerReviewSummary(orcid, putCode);
    orcidSecurityManager.checkAndFilter(orcid, ps, ScopePathType.PEER_REVIEW_READ_LIMITED);
    ActivityUtils.setPathToActivity(ps, orcid);
    sourceUtils.setSourceName(ps);
    return Response.ok(ps).build();
}
Also used : PeerReviewSummary(org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)

Example 17 with PeerReviewSummary

use of org.orcid.jaxb.model.record.summary_rc2.PeerReviewSummary in project ORCID-Source by ORCID.

the class PeerReviewManagerTest method getPeerReviewSummary.

private PeerReviewSummary getPeerReviewSummary(String titleValue, String extIdValue, Visibility visibility) {
    PeerReviewSummary summary = new PeerReviewSummary();
    summary.setGroupId(titleValue);
    summary.setVisibility(visibility);
    ExternalIDs extIds = new ExternalIDs();
    ExternalID extId = new ExternalID();
    extId.setRelationship(Relationship.SELF);
    extId.setType("doi");
    extId.setUrl(new Url("http://orcid.org"));
    extId.setValue(extIdValue);
    extIds.getExternalIdentifier().add(extId);
    summary.setExternalIdentifiers(extIds);
    return summary;
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) PeerReviewSummary(org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Url(org.orcid.jaxb.model.common_v2.Url)

Example 18 with PeerReviewSummary

use of org.orcid.jaxb.model.record.summary_rc2.PeerReviewSummary in project ORCID-Source by ORCID.

the class PeerReviewManagerTest method nonGroupableIdsGenerateEmptyIdsListTest.

@Test
public void nonGroupableIdsGenerateEmptyIdsListTest() {
    PeerReviewSummary s1 = getPeerReviewSummary("Element 1", "ext-id-1", Visibility.PUBLIC);
    PeerReviewSummary s2 = getPeerReviewSummary("Element 2", "ext-id-2", Visibility.LIMITED);
    PeerReviewSummary s3 = getPeerReviewSummary("Element 3", "ext-id-3", Visibility.PRIVATE);
    // Remove the grouping id from s1
    s1.setGroupId(null);
    List<PeerReviewSummary> peerReviewsList = Arrays.asList(s1, s2, s3);
    /**
         * They should be grouped as
         * 
         * Group 1: Element 1
         * Group 2: Element 2
         * Group 3: Element 3
         * */
    PeerReviews peerReviews = peerReviewManager.groupPeerReviews(peerReviewsList, false);
    assertNotNull(peerReviews);
    assertEquals(3, peerReviews.getPeerReviewGroup().size());
    boolean foundEmptyGroup = false;
    boolean found2 = false;
    boolean found3 = false;
    for (PeerReviewGroup group : peerReviews.getPeerReviewGroup()) {
        assertEquals(1, group.getPeerReviewSummary().size());
        assertNotNull(group.getIdentifiers().getExternalIdentifier());
        assertEquals(1, group.getIdentifiers().getExternalIdentifier().size());
        if (group.getIdentifiers().getExternalIdentifier().get(0).getValue() == null) {
            assertEquals("ext-id-1", group.getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
            foundEmptyGroup = true;
        } else if (group.getIdentifiers().getExternalIdentifier().get(0).getValue().equals("Element 2")) {
            assertEquals("ext-id-2", group.getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
            found2 = true;
        } else if (group.getIdentifiers().getExternalIdentifier().get(0).getValue().equals("Element 3")) {
            assertEquals("ext-id-3", group.getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
            found3 = true;
        } else {
            fail("Invalid ext id found " + group.getIdentifiers().getExternalIdentifier().get(0).getValue());
        }
    }
    assertTrue(foundEmptyGroup);
    assertTrue(found2);
    assertTrue(found3);
}
Also used : PeerReviewGroup(org.orcid.jaxb.model.record.summary_v2.PeerReviewGroup) PeerReviewSummary(org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary) PeerReviews(org.orcid.jaxb.model.record.summary_v2.PeerReviews) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 19 with PeerReviewSummary

use of org.orcid.jaxb.model.record.summary_rc2.PeerReviewSummary in project ORCID-Source by ORCID.

the class PeerReviewManagerTest method testGetAllSummaries.

@Test
public void testGetAllSummaries() {
    String orcid = "0000-0000-0000-0003";
    List<PeerReviewSummary> elements = peerReviewManager.getPeerReviewSummaryList(orcid, System.currentTimeMillis());
    boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
    for (PeerReviewSummary element : elements) {
        if (9 == element.getPutCode()) {
            found1 = true;
        } else if (10 == element.getPutCode()) {
            found2 = true;
        } else if (11 == element.getPutCode()) {
            found3 = true;
        } else if (12 == element.getPutCode()) {
            found4 = true;
        } else if (13 == element.getPutCode()) {
            found5 = true;
        } else {
            fail("Invalid element found: " + element.getPutCode());
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
    assertTrue(found5);
}
Also used : PeerReviewSummary(org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 20 with PeerReviewSummary

use of org.orcid.jaxb.model.record.summary_rc2.PeerReviewSummary in project ORCID-Source by ORCID.

the class PeerReviewManagerTest method testGroupPeerReviews_groupOnlyPublicPeerReviews1.

@Test
public void testGroupPeerReviews_groupOnlyPublicPeerReviews1() {
    PeerReviewSummary s1 = getPeerReviewSummary("public-peer-review-group-id-1", "ext-id-1", Visibility.PUBLIC);
    PeerReviewSummary s2 = getPeerReviewSummary("limited-peer-review-group-id-1", "ext-id-2", Visibility.LIMITED);
    PeerReviewSummary s3 = getPeerReviewSummary("private-peer-review-group-id-1", "ext-id-3", Visibility.PRIVATE);
    PeerReviewSummary s4 = getPeerReviewSummary("public-peer-review-group-id-2", "ext-id-4", Visibility.PUBLIC);
    PeerReviewSummary s5 = getPeerReviewSummary("limited-peer-review-group-id-2", "ext-id-5", Visibility.LIMITED);
    PeerReviewSummary s6 = getPeerReviewSummary("private-peer-review-group-id-2", "ext-id-6", Visibility.PRIVATE);
    PeerReviewSummary s7 = getPeerReviewSummary("public-peer-review-group-id-3", "ext-id-7", Visibility.PUBLIC);
    PeerReviewSummary s8 = getPeerReviewSummary("limited-peer-review-group-id-3", "ext-id-8", Visibility.LIMITED);
    PeerReviewSummary s9 = getPeerReviewSummary("private-peer-review-group-id-3", "ext-id-9", Visibility.PRIVATE);
    List<PeerReviewSummary> workList = Arrays.asList(s1, s2, s3, s4, s5, s6, s7, s8, s9);
    /**
         * They should be grouped as
         * 
         * Group 1: Public 1
         * Group 2: Public 2
         * Group 3: Public 3
         * */
    PeerReviews peerReviews = peerReviewManager.groupPeerReviews(workList, true);
    assertNotNull(peerReviews);
    assertEquals(3, peerReviews.getPeerReviewGroup().size());
    assertEquals(1, peerReviews.getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    assertEquals(1, peerReviews.getPeerReviewGroup().get(0).getPeerReviewSummary().size());
    assertEquals("public-peer-review-group-id-1", peerReviews.getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getValue());
    assertEquals("public-peer-review-group-id-1", peerReviews.getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getGroupId());
    assertEquals(1, peerReviews.getPeerReviewGroup().get(1).getIdentifiers().getExternalIdentifier().size());
    assertEquals(1, peerReviews.getPeerReviewGroup().get(1).getPeerReviewSummary().size());
    assertEquals("public-peer-review-group-id-2", peerReviews.getPeerReviewGroup().get(1).getIdentifiers().getExternalIdentifier().get(0).getValue());
    assertEquals("public-peer-review-group-id-2", peerReviews.getPeerReviewGroup().get(1).getPeerReviewSummary().get(0).getGroupId());
    assertEquals(1, peerReviews.getPeerReviewGroup().get(2).getIdentifiers().getExternalIdentifier().size());
    assertEquals(1, peerReviews.getPeerReviewGroup().get(2).getPeerReviewSummary().size());
    assertEquals("public-peer-review-group-id-3", peerReviews.getPeerReviewGroup().get(2).getIdentifiers().getExternalIdentifier().get(0).getValue());
    assertEquals("public-peer-review-group-id-3", peerReviews.getPeerReviewGroup().get(2).getPeerReviewSummary().get(0).getGroupId());
}
Also used : PeerReviewSummary(org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary) PeerReviews(org.orcid.jaxb.model.record.summary_v2.PeerReviews) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)64 Test (org.junit.Test)59 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)43 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)43 ActivitiesSummary (org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary)37 ClientResponse (com.sun.jersey.api.client.ClientResponse)20 PeerReviewGroup (org.orcid.jaxb.model.record.summary_v2.PeerReviewGroup)17 PeerReviews (org.orcid.jaxb.model.record.summary_v2.PeerReviews)16 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 OtherName (org.orcid.jaxb.model.record_v2.OtherName)16 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)16 Record (org.orcid.jaxb.model.record_v2.Record)16 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)16 Addresses (org.orcid.jaxb.model.record_v2.Addresses)15 Biography (org.orcid.jaxb.model.record_v2.Biography)15 Emails (org.orcid.jaxb.model.record_v2.Emails)15