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();
}
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;
}
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);
}
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);
}
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());
}
Aggregations