Search in sources :

Example 36 with PeerReviewSummary

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

the class MemberV3ApiServiceDelegator_PeerReviewsTest method testViewPeerReviews.

@Test
public void testViewPeerReviews() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
    Response r = serviceDelegator.viewPeerReviews(ORCID);
    assertNotNull(r);
    PeerReviews peerReviews = (PeerReviews) r.getEntity();
    assertNotNull(peerReviews);
    assertEquals("/0000-0000-0000-0003/peer-reviews", peerReviews.getPath());
    Utils.verifyLastModified(peerReviews.getLastModifiedDate());
    assertNotNull(peerReviews.getPeerReviewGroup());
    assertEquals(4, peerReviews.getPeerReviewGroup().size());
    boolean found1 = false, found2 = false, found3 = false, found4 = false;
    for (PeerReviewGroup group : peerReviews.getPeerReviewGroup()) {
        Utils.verifyLastModified(group.getLastModifiedDate());
        assertNotNull(group.getIdentifiers());
        assertNotNull(group.getIdentifiers().getExternalIdentifier());
        assertEquals(1, group.getIdentifiers().getExternalIdentifier().size());
        assertNotNull(group.getPeerReviewSummary());
        assertEquals(1, group.getPeerReviewSummary().size());
        PeerReviewSummary summary = group.getPeerReviewSummary().get(0);
        Utils.verifyLastModified(summary.getLastModifiedDate());
        switch(group.getIdentifiers().getExternalIdentifier().get(0).getValue()) {
            case "issn:0000009":
                assertEquals("issn:0000009", summary.getGroupId());
                assertEquals(Long.valueOf(9), summary.getPutCode());
                found1 = true;
                break;
            case "issn:0000010":
                assertEquals("issn:0000010", summary.getGroupId());
                assertEquals(Long.valueOf(10), summary.getPutCode());
                found2 = true;
                break;
            case "issn:0000011":
                assertEquals("issn:0000011", summary.getGroupId());
                assertEquals(Long.valueOf(11), summary.getPutCode());
                found3 = true;
                break;
            case "issn:0000012":
                assertEquals("issn:0000012", summary.getGroupId());
                assertEquals(Long.valueOf(12), summary.getPutCode());
                found4 = true;
                break;
            default:
                fail("Invalid group id found: " + group.getIdentifiers().getExternalIdentifier().get(0).getValue());
                break;
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
}
Also used : Response(javax.ws.rs.core.Response) PeerReviewGroup(org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewGroup) PeerReviewSummary(org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary) PeerReviews(org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviews) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 37 with PeerReviewSummary

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

the class PublicV3ApiServiceDelegatorTest 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.v3.dev1.record.summary.PeerReviewSummary) PeerReviews(org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviews) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 38 with PeerReviewSummary

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

the class PublicV3ApiServiceDelegatorImpl method viewPeerReviewSummary.

@Override
public Response viewPeerReviewSummary(String orcid, Long putCode) {
    PeerReviewSummary summary = peerReviewManagerReadOnly.getPeerReviewSummary(orcid, putCode);
    publicAPISecurityManagerV3.checkIsPublic(summary);
    ActivityUtils.setPathToActivity(summary, orcid);
    sourceUtilsReadOnly.setSourceName(summary);
    return Response.ok(summary).build();
}
Also used : PeerReviewSummary(org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary)

Example 39 with PeerReviewSummary

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

the class PublicV3ApiServiceDelegatorImpl method viewPeerReviews.

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

Example 40 with PeerReviewSummary

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

the class MapperFacadeFactory method getPeerReviewMapperFacade.

public MapperFacade getPeerReviewMapperFacade() {
    MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
    ConverterFactory converterFactory = mapperFactory.getConverterFactory();
    converterFactory.registerConverter("workExternalIdentifiersConverterId", new JSONWorkExternalIdentifiersConverterV3(norm, localeManager));
    converterFactory.registerConverter("workExternalIdentifierConverterId", new JSONPeerReviewWorkExternalIdentifierConverterV3());
    // do same as work
    ClassMapBuilder<PeerReview, PeerReviewEntity> classMap = mapperFactory.classMap(PeerReview.class, PeerReviewEntity.class);
    addV3CommonFields(classMap);
    registerSourceConverters(mapperFactory, classMap);
    classMap.field("url.value", "url");
    classMap.field("organization.name", "org.name");
    classMap.field("organization.address.city", "org.city");
    classMap.field("organization.address.region", "org.region");
    classMap.field("organization.address.country", "org.country");
    classMap.field("organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier", "org.orgDisambiguated.sourceId");
    classMap.field("organization.disambiguatedOrganization.disambiguationSource", "org.orgDisambiguated.sourceType");
    classMap.field("groupId", "groupId");
    classMap.field("subjectType", "subjectType");
    classMap.field("subjectUrl.value", "subjectUrl");
    classMap.field("subjectName.title.content", "subjectName");
    classMap.field("subjectName.translatedTitle.content", "subjectTranslatedName");
    classMap.field("subjectName.translatedTitle.languageCode", "subjectTranslatedNameLanguageCode");
    classMap.field("subjectContainerName.content", "subjectContainerName");
    classMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
    classMap.fieldMap("subjectExternalIdentifier", "subjectExternalIdentifiersJson").converter("workExternalIdentifierConverterId").add();
    classMap.register();
    ClassMapBuilder<PeerReviewSummary, PeerReviewEntity> peerReviewSummaryClassMap = mapperFactory.classMap(PeerReviewSummary.class, PeerReviewEntity.class);
    addV3CommonFields(peerReviewSummaryClassMap);
    registerSourceConverters(mapperFactory, peerReviewSummaryClassMap);
    peerReviewSummaryClassMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
    peerReviewSummaryClassMap.field("organization.name", "org.name");
    peerReviewSummaryClassMap.field("organization.address.city", "org.city");
    peerReviewSummaryClassMap.field("organization.address.region", "org.region");
    peerReviewSummaryClassMap.field("organization.address.country", "org.country");
    peerReviewSummaryClassMap.field("organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier", "org.orgDisambiguated.sourceId");
    peerReviewSummaryClassMap.field("organization.disambiguatedOrganization.disambiguationSource", "org.orgDisambiguated.sourceType");
    peerReviewSummaryClassMap.register();
    mapperFactory.classMap(FuzzyDate.class, CompletionDateEntity.class).field("year.value", "year").field("month.value", "month").field("day.value", "day").register();
    return mapperFactory.getMapperFacade();
}
Also used : JSONWorkExternalIdentifiersConverterV3(org.orcid.core.adapter.jsonidentifier.converter.JSONWorkExternalIdentifiersConverterV3) PeerReviewSummary(org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary) PeerReviewEntity(org.orcid.persistence.jpa.entities.PeerReviewEntity) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) MapperFactory(ma.glasnost.orika.MapperFactory) ConverterFactory(ma.glasnost.orika.converter.ConverterFactory) JSONPeerReviewWorkExternalIdentifierConverterV3(org.orcid.core.adapter.jsonidentifier.converter.JSONPeerReviewWorkExternalIdentifierConverterV3) PeerReview(org.orcid.jaxb.model.v3.dev1.record.PeerReview)

Aggregations

PeerReviewSummary (org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary)61 Test (org.junit.Test)46 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)39 EmploymentSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary)39 FundingSummary (org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary)39 WorkSummary (org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)39 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)35 DistinctionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary)34 InvitedPositionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary)34 MembershipSummary (org.orcid.jaxb.model.v3.dev1.record.summary.MembershipSummary)34 QualificationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.QualificationSummary)34 ServiceSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ServiceSummary)34 PeerReviews (org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviews)15 Address (org.orcid.jaxb.model.v3.dev1.record.Address)14 Email (org.orcid.jaxb.model.v3.dev1.record.Email)14 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)14 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)14 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)14 Record (org.orcid.jaxb.model.v3.dev1.record.Record)14 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)14