use of org.orcid.jaxb.model.record_rc3.PeerReview in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method createPeerReview.
@Override
public Response createPeerReview(String orcid, PeerReview peerReview) {
orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.PEER_REVIEW_CREATE);
clearSource(peerReview);
PeerReview newPeerReview = peerReviewManager.createPeerReview(orcid, peerReview, true);
sourceUtils.setSourceName(newPeerReview);
try {
return Response.created(new URI(String.valueOf(newPeerReview.getPutCode()))).build();
} catch (URISyntaxException ex) {
throw new RuntimeException(localeManager.resolveMessage("apiError.createpeerreview_response.exception"), ex);
}
}
use of org.orcid.jaxb.model.record_rc3.PeerReview in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_PeerReviewsTest method testViewPeerReviewReadPublic.
@Test
public void testViewPeerReviewReadPublic() {
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewPeerReview("4444-4444-4444-4447", 2L);
PeerReview element = (PeerReview) r.getEntity();
assertNotNull(element);
assertEquals("/4444-4444-4444-4447/peer-review/2", element.getPath());
Utils.assertIsPublicOrSource(element, "APP-5555555555555555");
}
use of org.orcid.jaxb.model.record_rc3.PeerReview in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_PeerReviewsTest method testUpdatePeerReviewLeavingVisibilityNullTest.
@Test
public void testUpdatePeerReviewLeavingVisibilityNullTest() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4447", ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewPeerReview("4444-4444-4444-4447", 6L);
assertNotNull(response);
PeerReview peerReview = (PeerReview) response.getEntity();
assertNotNull(peerReview);
assertEquals(Visibility.PUBLIC, peerReview.getVisibility());
peerReview.setVisibility(null);
response = serviceDelegator.updatePeerReview("4444-4444-4444-4447", 6L, peerReview);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
peerReview = (PeerReview) response.getEntity();
assertNotNull(peerReview);
assertEquals(Visibility.PUBLIC, peerReview.getVisibility());
}
use of org.orcid.jaxb.model.record_rc3.PeerReview in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_PeerReviewsTest method testViewPublicPeerReview.
@Test
public void testViewPublicPeerReview() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4446", ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewPeerReview("4444-4444-4444-4446", 1L);
assertNotNull(response);
PeerReview peerReview = (PeerReview) response.getEntity();
assertNotNull(peerReview);
assertEquals("/4444-4444-4444-4446/peer-review/1", peerReview.getPath());
Utils.verifyLastModified(peerReview.getLastModifiedDate());
assertEquals(Long.valueOf(1L), peerReview.getPutCode());
assertNotNull(peerReview.getCompletionDate());
assertEquals("01", peerReview.getCompletionDate().getDay().getValue());
assertEquals("01", peerReview.getCompletionDate().getMonth().getValue());
assertEquals("2015", peerReview.getCompletionDate().getYear().getValue());
assertEquals("work:external-identifier-id#1", peerReview.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals("reviewer", peerReview.getRole().value());
assertEquals("APP-5555555555555555", peerReview.getSource().retrieveSourcePath());
assertEquals("public", peerReview.getVisibility().value());
assertEquals("review", peerReview.getType().value());
assertEquals("http://peer_review.com", peerReview.getUrl().getValue());
assertEquals("Peer Review # 1", peerReview.getSubjectName().getTitle().getContent());
assertEquals("es", peerReview.getSubjectName().getTranslatedTitle().getLanguageCode());
assertEquals("artistic-performance", peerReview.getSubjectType().value());
assertEquals("http://work.com", peerReview.getSubjectUrl().getValue());
assertEquals("Peer Review # 1 container name", peerReview.getSubjectContainerName().getContent());
assertEquals("peer-review:subject-external-identifier-id#1", peerReview.getSubjectExternalIdentifier().getValue());
assertEquals("agr", peerReview.getSubjectExternalIdentifier().getType());
assertEquals("issn:0000001", peerReview.getGroupId());
}
use of org.orcid.jaxb.model.record_rc3.PeerReview in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_PeerReviewsTest method testAddPeerReviewDuplicateFails.
@Test(expected = OrcidDuplicatedActivityException.class)
public void testAddPeerReviewDuplicateFails() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4447", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewPeerReview("4444-4444-4444-4447", 6L);
assertNotNull(response);
PeerReview peerReview = (PeerReview) response.getEntity();
assertNotNull(peerReview);
peerReview.setUrl(new Url("http://updated.com/url"));
peerReview.getSubjectName().getTitle().setContent("Updated Title");
peerReview.setPutCode(null);
response = serviceDelegator.createPeerReview("4444-4444-4444-4447", peerReview);
}
Aggregations