use of org.orcid.jaxb.model.record_rc2.PeerReview in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorImpl method viewPeerReview.
@Override
public Response viewPeerReview(String orcid, Long putCode) {
PeerReview peerReview = peerReviewManagerReadOnly.getPeerReview(orcid, putCode);
publicAPISecurityManagerV2.checkIsPublic(peerReview);
ActivityUtils.setPathToActivity(peerReview, orcid);
sourceUtilsReadOnly.setSourceName(peerReview);
return Response.ok(peerReview).build();
}
use of org.orcid.jaxb.model.record_rc2.PeerReview in project ORCID-Source by ORCID.
the class ActivityManagerImpl method pubPeerReviewsMap.
public LinkedHashMap<Long, PeerReview> pubPeerReviewsMap(String orcid) {
List<PeerReview> peerReviews = peerReviewManager.findPeerReviews(orcid);
LinkedHashMap<Long, PeerReview> peerReviewMap = new LinkedHashMap<>();
if (peerReviews != null) {
if (!peerReviews.isEmpty()) {
for (PeerReview peerReview : peerReviews) {
if (peerReview.getVisibility().equals(Visibility.PUBLIC)) {
peerReviewMap.put(peerReview.getPutCode(), peerReview);
}
}
}
}
return peerReviewMap;
}
use of org.orcid.jaxb.model.record_rc2.PeerReview in project ORCID-Source by ORCID.
the class PublicProfileVisibilityTest method peerReviewPrivacyTest.
@Test
public void peerReviewPrivacyTest() throws InterruptedException, JSONException, URISyntaxException {
// Create peer review group
String accessToken = getAccessToken(getScopes(ScopePathType.PERSON_READ_LIMITED, ScopePathType.PERSON_UPDATE, ScopePathType.ACTIVITIES_READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE));
List<GroupIdRecord> groups = createGroupIds();
assertNotNull(groups);
assertTrue(groups.size() > 0);
GroupIdRecord g1 = groups.get(0);
// Create peer review
long time = System.currentTimeMillis();
PeerReview peerReview = new PeerReview();
peerReview.setGroupId(g1.getGroupId());
ExternalIDs extIds = new ExternalIDs();
peerReview.setExternalIdentifiers(extIds);
peerReview.getExternalIdentifiers().getExternalIdentifier().clear();
ExternalID wExtId = new ExternalID();
wExtId.setValue("Work Id " + time);
wExtId.setType(WorkExternalIdentifierType.AGR.value());
wExtId.setRelationship(Relationship.SELF);
peerReview.getExternalIdentifiers().getExternalIdentifier().add(wExtId);
Organization organization = new Organization();
organization.setName("My org name " + System.currentTimeMillis());
OrganizationAddress address = new OrganizationAddress();
address.setCity("Imagination city");
address.setCountry(Iso3166Country.US);
organization.setAddress(address);
peerReview.setOrganization(organization);
peerReview.setRole(Role.CHAIR);
peerReview.setType(PeerReviewType.EVALUATION);
peerReview.setCompletionDate(new FuzzyDate(new Year(2016), new Month(1), new Day(1)));
ClientResponse postResponse = memberV2ApiClient.createPeerReviewXml(this.getUser1OrcidId(), peerReview, accessToken);
assertNotNull(postResponse);
assertEquals(Response.Status.CREATED.getStatusCode(), postResponse.getStatus());
ClientResponse getResponse = memberV2ApiClient.viewLocationXml(postResponse.getLocation(), accessToken);
assertEquals(Response.Status.OK.getStatusCode(), getResponse.getStatus());
peerReview = getResponse.getEntity(PeerReview.class);
showMyOrcidPage();
changePeerReviewVisibility(g1.getName(), Visibility.PRIVATE.name());
try {
// Verify it doesn't appear in the public page
showPublicProfilePage(getUser1OrcidId());
peerReviewAppearsInPublicPage(g1.getName());
fail();
} catch (Exception e) {
}
showMyOrcidPage();
changePeerReviewVisibility(g1.getName(), Visibility.LIMITED.name());
try {
// Verify it doesn't appear in the public page
showPublicProfilePage(getUser1OrcidId());
peerReviewAppearsInPublicPage(g1.getName());
fail();
} catch (Exception e) {
}
showMyOrcidPage();
changePeerReviewVisibility(g1.getName(), Visibility.PUBLIC.name());
showPublicProfilePage(getUser1OrcidId());
peerReviewAppearsInPublicPage(g1.getName());
// Rollback
ClientResponse deleteResponse = memberV2ApiClient.deletePeerReviewXml(this.getUser1OrcidId(), peerReview.getPutCode(), accessToken);
assertNotNull(deleteResponse);
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), deleteResponse.getStatus());
}
use of org.orcid.jaxb.model.record_rc2.PeerReview in project ORCID-Source by ORCID.
the class JpaJaxbPeerReviewAdapterTest method fromOrgAffiliationRelationEntityToEducation.
@Test
public void fromOrgAffiliationRelationEntityToEducation() {
PeerReviewEntity entity = getPeerReviewEntity();
assertNotNull(entity);
PeerReview peerReview = jpaJaxbPeerReviewAdapter.toPeerReview(entity);
assertNotNull(peerReview);
assertEquals(Long.valueOf(12345), peerReview.getPutCode());
assertEquals("private", peerReview.getVisibility().value());
assertEquals("orcid-generated:12345", peerReview.getGroupId());
// Subject
assertNotNull(peerReview.getSubjectExternalIdentifier());
assertEquals("peer-review:subject-external-identifier-id", peerReview.getSubjectExternalIdentifier().getValue());
assertEquals("source-work-id", peerReview.getSubjectExternalIdentifier().getType());
assertEquals("peer-review:subject-container-name", peerReview.getSubjectContainerName().getContent());
assertEquals("peer-review:subject-name", peerReview.getSubjectName().getTitle().getContent());
assertEquals("peer-review:subject-translated-name", peerReview.getSubjectName().getTranslatedTitle().getContent());
assertEquals("en", peerReview.getSubjectName().getTranslatedTitle().getLanguageCode());
assertEquals(WorkType.BOOK_REVIEW.value(), peerReview.getSubjectType().value());
assertEquals("peer-review:subject-url", peerReview.getSubjectUrl().getValue());
// Fields
assertNotNull(peerReview.getExternalIdentifiers());
assertNotNull(peerReview.getExternalIdentifiers().getExternalIdentifier());
assertEquals(1, peerReview.getExternalIdentifiers().getExternalIdentifier().size());
assertEquals("peer-review:external-identifier-id", peerReview.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals("source-work-id", peerReview.getExternalIdentifiers().getExternalIdentifier().get(0).getType());
assertEquals(Role.MEMBER.value(), peerReview.getRole().value());
assertEquals(PeerReviewType.EVALUATION.value(), peerReview.getType().value());
assertEquals("peer-review:url", peerReview.getUrl().getValue());
assertNotNull(peerReview.getCompletionDate());
assertEquals("2015", peerReview.getCompletionDate().getYear().getValue());
assertEquals("01", peerReview.getCompletionDate().getMonth().getValue());
assertEquals("01", peerReview.getCompletionDate().getDay().getValue());
assertNotNull(peerReview.getOrganization());
assertEquals("org:name", peerReview.getOrganization().getName());
assertNotNull(peerReview.getOrganization().getAddress());
assertEquals("org:city", peerReview.getOrganization().getAddress().getCity());
assertEquals("org:region", peerReview.getOrganization().getAddress().getRegion());
assertNotNull(peerReview.getSource());
assertEquals("APP-000000001", peerReview.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.record_rc2.PeerReview in project ORCID-Source by ORCID.
the class JSONPeerReviewWorkExternalIdentifierConverterV2Test method testConvertTo.
@Test
public void testConvertTo() throws JAXBException {
PeerReview peerReview = getPeerReview();
assertEquals("{\"relationship\":\"SELF\",\"url\":{\"value\":\"http://orcid.org\"},\"workExternalIdentifierType\":\"DOI\",\"workExternalIdentifierId\":{\"content\":\"peer-review:subject-external-identifier-id\"}}", converter.convertTo(peerReview.getSubjectExternalIdentifier(), null));
}
Aggregations