use of org.orcid.jaxb.model.record.summary_rc4.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);
}
}
}
}
use of org.orcid.jaxb.model.record.summary_rc4.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;
}
use of org.orcid.jaxb.model.record.summary_rc4.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_rc4.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_rc4.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);
}
Aggregations