Search in sources :

Example 31 with PeerReviewSummary

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

the class MemberV2PerformanceTest method cleanActivities.

private void cleanActivities() throws JSONException, InterruptedException, URISyntaxException {
    String token = getAccessToken();
    // Remove all activities
    ClientResponse activitiesResponse = memberV2ApiClient.viewActivities(this.getUser1OrcidId(), token);
    assertNotNull(activitiesResponse);
    ActivitiesSummary summary = activitiesResponse.getEntity(ActivitiesSummary.class);
    assertNotNull(summary);
    if (summary.getEducations() != null && !summary.getEducations().getSummaries().isEmpty()) {
        for (EducationSummary education : summary.getEducations().getSummaries()) {
            memberV2ApiClient.deleteEducationXml(this.getUser1OrcidId(), education.getPutCode(), token);
        }
    }
    if (summary.getEmployments() != null && !summary.getEmployments().getSummaries().isEmpty()) {
        for (EmploymentSummary employment : summary.getEmployments().getSummaries()) {
            memberV2ApiClient.deleteEmploymentXml(this.getUser1OrcidId(), employment.getPutCode(), token);
        }
    }
    if (summary.getFundings() != null && !summary.getFundings().getFundingGroup().isEmpty()) {
        for (FundingGroup group : summary.getFundings().getFundingGroup()) {
            for (FundingSummary funding : group.getFundingSummary()) {
                memberV2ApiClient.deleteFundingXml(this.getUser1OrcidId(), funding.getPutCode(), token);
            }
        }
    }
    if (summary.getWorks() != null && !summary.getWorks().getWorkGroup().isEmpty()) {
        for (WorkGroup group : summary.getWorks().getWorkGroup()) {
            for (WorkSummary work : group.getWorkSummary()) {
                memberV2ApiClient.deleteWorkXml(this.getUser1OrcidId(), work.getPutCode(), token);
            }
        }
    }
    if (summary.getPeerReviews() != null && !summary.getPeerReviews().getPeerReviewGroup().isEmpty()) {
        for (PeerReviewGroup group : summary.getPeerReviews().getPeerReviewGroup()) {
            for (PeerReviewSummary peerReview : group.getPeerReviewSummary()) {
                memberV2ApiClient.deletePeerReviewXml(this.getUser1OrcidId(), peerReview.getPutCode(), token);
            }
        }
    }
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) WorkGroup(org.orcid.jaxb.model.record.summary_v2.WorkGroup) PeerReviewGroup(org.orcid.jaxb.model.record.summary_v2.PeerReviewGroup) 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) FundingGroup(org.orcid.jaxb.model.record.summary_v2.FundingGroup) ActivitiesSummary(org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary)

Example 32 with PeerReviewSummary

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

the class PublicAPISecurityManagerV2Test method getPeerReviews.

private PeerReviews getPeerReviews(Visibility... vs) {
    PeerReviews peerReviews = new PeerReviews();
    for (Visibility v : vs) {
        PeerReviewGroup g = new PeerReviewGroup();
        PeerReviewSummary s = new PeerReviewSummary();
        s.setVisibility(v);
        g.getPeerReviewSummary().add(s);
        peerReviews.getPeerReviewGroup().add(g);
    }
    return peerReviews;
}
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) Visibility(org.orcid.jaxb.model.common_v2.Visibility)

Example 33 with PeerReviewSummary

use of org.orcid.jaxb.model.record.summary_v2.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 34 with PeerReviewSummary

use of org.orcid.jaxb.model.record.summary_v2.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 35 with PeerReviewSummary

use of org.orcid.jaxb.model.record.summary_v2.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)

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