Search in sources :

Example 46 with PeerReviewSummary

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

the class PublicV2ApiServiceDelegatorImpl method viewPeerReviews.

@Override
public Response viewPeerReviews(String orcid) {
    List<PeerReviewSummary> peerReviews = peerReviewManagerReadOnly.getPeerReviewSummaryList(orcid);
    PeerReviews publicPeerReviews = peerReviewManagerReadOnly.groupPeerReviews(peerReviews, true);
    publicAPISecurityManagerV2.filter(publicPeerReviews);
    ActivityUtils.setPathToPeerReviews(publicPeerReviews, orcid);
    Api2_0_LastModifiedDatesHelper.calculateLastModified(publicPeerReviews);
    sourceUtilsReadOnly.setSourceName(publicPeerReviews);
    return Response.ok(publicPeerReviews).build();
}
Also used : PeerReviewSummary(org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary) PeerReviews(org.orcid.jaxb.model.record.summary_v2.PeerReviews)

Example 47 with PeerReviewSummary

use of org.orcid.jaxb.model.record.summary_rc3.PeerReviewSummary 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.record.summary_v2.PeerReviewGroup) Fundings(org.orcid.jaxb.model.record.summary_v2.Fundings) PeerReviews(org.orcid.jaxb.model.record.summary_v2.PeerReviews) FundingGroup(org.orcid.jaxb.model.record.summary_v2.FundingGroup) Employments(org.orcid.jaxb.model.record.summary_v2.Employments) WorkGroup(org.orcid.jaxb.model.record.summary_v2.WorkGroup) 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 PeerReviewSummary

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

the class JpaJaxbPeerReviewAdapterTest method fromPeerReviewEntityToPeerReviewSummary.

@Test
public void fromPeerReviewEntityToPeerReviewSummary() {
    PeerReviewEntity entity = getPeerReviewEntity();
    assertNotNull(entity);
    PeerReviewSummary peerReviewSummary = jpaJaxbPeerReviewAdapter.toPeerReviewSummary(entity);
    assertNotNull(peerReviewSummary);
    assertEquals(Long.valueOf(12345), peerReviewSummary.getPutCode());
    assertEquals("private", peerReviewSummary.getVisibility().value());
    assertNotNull(peerReviewSummary.getCompletionDate());
    assertEquals("2015", peerReviewSummary.getCompletionDate().getYear().getValue());
    assertEquals("01", peerReviewSummary.getCompletionDate().getMonth().getValue());
    assertEquals("01", peerReviewSummary.getCompletionDate().getDay().getValue());
    assertNotNull(peerReviewSummary.getExternalIdentifiers());
    assertNotNull(peerReviewSummary.getExternalIdentifiers().getExternalIdentifier());
    assertEquals(1, peerReviewSummary.getExternalIdentifiers().getExternalIdentifier().size());
    assertEquals("peer-review:external-identifier-id", peerReviewSummary.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
    assertEquals("source-work-id", peerReviewSummary.getExternalIdentifiers().getExternalIdentifier().get(0).getType());
    assertNotNull(peerReviewSummary.getSource());
    assertEquals("APP-000000001", peerReviewSummary.getSource().retrieveSourcePath());
}
Also used : PeerReviewSummary(org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary) PeerReviewEntity(org.orcid.persistence.jpa.entities.PeerReviewEntity) Test(org.junit.Test)

Example 49 with PeerReviewSummary

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

the class PublicV2Test method checkPeerReview.

public void checkPeerReview(String readPublicToken) throws JSONException, InterruptedException, URISyntaxException {
    PeerReview peerReviewToCreate = (PeerReview) unmarshallFromPath("/record_2.0_rc1/samples/peer-review-2.0_rc1.xml", PeerReview.class);
    peerReviewToCreate.setPutCode(null);
    peerReviewToCreate.setGroupId(groupRecords.get(0).getGroupId());
    peerReviewToCreate.setVisibility(org.orcid.jaxb.model.common_rc1.Visibility.PUBLIC);
    String accessToken = getAccessToken();
    ClientResponse postResponse = memberV2ApiClient.createPeerReviewXml(getUser1OrcidId(), peerReviewToCreate, accessToken);
    assertNotNull(postResponse);
    assertEquals(Response.Status.CREATED.getStatusCode(), postResponse.getStatus());
    String path = postResponse.getLocation().getPath();
    String putCode = path.substring(path.lastIndexOf('/') + 1, path.length());
    ClientResponse getPeerReviewResponse = null;
    if (readPublicToken != null) {
        getPeerReviewResponse = publicV2ApiClient.viewPeerReviewXml(getUser1OrcidId(), putCode, readPublicToken);
    } else {
        getPeerReviewResponse = publicV2ApiClient.viewPeerReviewXml(getUser1OrcidId(), putCode);
    }
    assertNotNull(getPeerReviewResponse);
    checkResponse(getPeerReviewResponse);
    PeerReview peerReview = getPeerReviewResponse.getEntity(PeerReview.class);
    assertNotNull(peerReview);
    assertEquals("peer-review:url", peerReview.getUrl().getValue());
    ClientResponse getPeerReviewSummaryResponse = publicV2ApiClient.viewPeerReviewSummaryXml(getUser1OrcidId(), putCode);
    if (readPublicToken != null) {
        getPeerReviewSummaryResponse = publicV2ApiClient.viewPeerReviewSummaryXml(getUser1OrcidId(), putCode, readPublicToken);
    } else {
        getPeerReviewSummaryResponse = publicV2ApiClient.viewPeerReviewSummaryXml(getUser1OrcidId(), putCode);
    }
    assertNotNull(getPeerReviewSummaryResponse);
    checkResponse(getPeerReviewSummaryResponse);
    PeerReviewSummary summary = getPeerReviewSummaryResponse.getEntity(PeerReviewSummary.class);
    assertNotNull(summary);
    assertEquals("1848", summary.getCompletionDate().getYear().getValue());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) PeerReviewSummary(org.orcid.jaxb.model.record.summary_rc1.PeerReviewSummary) PeerReview(org.orcid.jaxb.model.record_rc1.PeerReview)

Example 50 with PeerReviewSummary

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

the class PublicV2ApiServiceDelegatorTest method testViewPeerReviews.

@Test
public void testViewPeerReviews() {
    Response response = serviceDelegator.viewPeerReviews(ORCID);
    assertNotNull(response);
    PeerReviews peerReviews = (PeerReviews) response.getEntity();
    assertNotNull(peerReviews);
    assertEquals("/0000-0000-0000-0003/peer-reviews", peerReviews.getPath());
    assertNotNull(peerReviews.getLastModifiedDate());
    assertNotNull(peerReviews.getLastModifiedDate().getValue());
    assertEquals(1, peerReviews.getPeerReviewGroup().size());
    assertEquals(1, peerReviews.getPeerReviewGroup().get(0).getPeerReviewSummary().size());
    PeerReviewSummary peerReview = peerReviews.getPeerReviewGroup().get(0).getPeerReviewSummary().get(0);
    assertEquals(Long.valueOf(9), peerReview.getPutCode());
    assertNotNull(peerReview.getLastModifiedDate());
    assertNotNull(peerReview.getLastModifiedDate().getValue());
    assertEquals("02", peerReview.getCompletionDate().getDay().getValue());
    assertEquals("02", peerReview.getCompletionDate().getMonth().getValue());
    assertEquals("2016", peerReview.getCompletionDate().getYear().getValue());
    assertNotNull(peerReview.getExternalIdentifiers());
    assertNotNull(peerReview.getExternalIdentifiers().getExternalIdentifier());
    assertEquals(1, peerReview.getExternalIdentifiers().getExternalIdentifier().size());
    assertEquals("/0000-0000-0000-0003/peer-review/9", peerReview.getPath());
    assertEquals("work:external-identifier-id#1", peerReview.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
    assertEquals(Visibility.PUBLIC.value(), peerReview.getVisibility().value());
    assertEquals("APP-5555555555555555", peerReview.getSource().retrieveSourcePath());
}
Also used : Response(javax.ws.rs.core.Response) PeerReviewSummary(org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary) PeerReviews(org.orcid.jaxb.model.record.summary_v2.PeerReviews) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)65 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)18 PeerReviews (org.orcid.jaxb.model.record.summary_v2.PeerReviews)17 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