use of org.orcid.jaxb.model.record.summary_rc3.PeerReviewSummary in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorImpl method viewPeerReviews.
@Override
public Response viewPeerReviews(String orcid) {
List<PeerReviewSummary> peerReviews = peerReviewManagerReadOnly.getPeerReviewSummaryList(orcid);
PeerReviews publicPeerReviews = peerReviewManagerReadOnly.groupPeerReviews(peerReviews, true);
publicAPISecurityManagerV2.filter(publicPeerReviews);
ActivityUtils.setPathToPeerReviews(publicPeerReviews, orcid);
Api2_0_LastModifiedDatesHelper.calculateLastModified(publicPeerReviews);
sourceUtilsReadOnly.setSourceName(publicPeerReviews);
return Response.ok(publicPeerReviews).build();
}
use of org.orcid.jaxb.model.record.summary_rc3.PeerReviewSummary in project ORCID-Source by ORCID.
the class SourceUtils method setSourceName.
public void setSourceName(ActivitiesSummary as) {
if (as == null) {
return;
}
if (as.getEducations() != null) {
Educations educations = as.getEducations();
List<EducationSummary> list = educations.getSummaries();
if (list != null) {
for (EducationSummary summary : list) {
setSourceName(summary);
}
}
}
if (as.getEmployments() != null) {
Employments employments = as.getEmployments();
List<EmploymentSummary> list = employments.getSummaries();
if (list != null) {
for (EmploymentSummary summary : list) {
setSourceName(summary);
}
}
}
if (as.getFundings() != null) {
Fundings fundings = as.getFundings();
List<FundingGroup> groups = fundings.getFundingGroup();
if (groups != null) {
for (FundingGroup group : groups) {
List<FundingSummary> summaryList = group.getFundingSummary();
if (summaryList != null) {
for (FundingSummary summary : summaryList) {
setSourceName(summary);
}
}
}
}
}
if (as.getPeerReviews() != null) {
PeerReviews peerReviews = as.getPeerReviews();
List<PeerReviewGroup> groups = peerReviews.getPeerReviewGroup();
if (groups != null) {
for (PeerReviewGroup group : groups) {
List<PeerReviewSummary> summaryList = group.getPeerReviewSummary();
if (summaryList != null) {
for (PeerReviewSummary summary : summaryList) {
setSourceName(summary);
}
}
}
}
}
if (as.getWorks() != null) {
Works works = as.getWorks();
List<WorkGroup> groups = works.getWorkGroup();
if (groups != null) {
for (WorkGroup group : groups) {
List<WorkSummary> summaryList = group.getWorkSummary();
if (summaryList != null) {
for (WorkSummary summary : summaryList) {
setSourceName(summary);
}
}
}
}
}
}
use of org.orcid.jaxb.model.record.summary_rc3.PeerReviewSummary in project ORCID-Source by ORCID.
the class JpaJaxbPeerReviewAdapterTest method fromPeerReviewEntityToPeerReviewSummary.
@Test
public void fromPeerReviewEntityToPeerReviewSummary() {
PeerReviewEntity entity = getPeerReviewEntity();
assertNotNull(entity);
PeerReviewSummary peerReviewSummary = jpaJaxbPeerReviewAdapter.toPeerReviewSummary(entity);
assertNotNull(peerReviewSummary);
assertEquals(Long.valueOf(12345), peerReviewSummary.getPutCode());
assertEquals("private", peerReviewSummary.getVisibility().value());
assertNotNull(peerReviewSummary.getCompletionDate());
assertEquals("2015", peerReviewSummary.getCompletionDate().getYear().getValue());
assertEquals("01", peerReviewSummary.getCompletionDate().getMonth().getValue());
assertEquals("01", peerReviewSummary.getCompletionDate().getDay().getValue());
assertNotNull(peerReviewSummary.getExternalIdentifiers());
assertNotNull(peerReviewSummary.getExternalIdentifiers().getExternalIdentifier());
assertEquals(1, peerReviewSummary.getExternalIdentifiers().getExternalIdentifier().size());
assertEquals("peer-review:external-identifier-id", peerReviewSummary.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals("source-work-id", peerReviewSummary.getExternalIdentifiers().getExternalIdentifier().get(0).getType());
assertNotNull(peerReviewSummary.getSource());
assertEquals("APP-000000001", peerReviewSummary.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.record.summary_rc3.PeerReviewSummary in project ORCID-Source by ORCID.
the class PublicV2Test method checkPeerReview.
public void checkPeerReview(String readPublicToken) throws JSONException, InterruptedException, URISyntaxException {
PeerReview peerReviewToCreate = (PeerReview) unmarshallFromPath("/record_2.0_rc1/samples/peer-review-2.0_rc1.xml", PeerReview.class);
peerReviewToCreate.setPutCode(null);
peerReviewToCreate.setGroupId(groupRecords.get(0).getGroupId());
peerReviewToCreate.setVisibility(org.orcid.jaxb.model.common_rc1.Visibility.PUBLIC);
String accessToken = getAccessToken();
ClientResponse postResponse = memberV2ApiClient.createPeerReviewXml(getUser1OrcidId(), peerReviewToCreate, accessToken);
assertNotNull(postResponse);
assertEquals(Response.Status.CREATED.getStatusCode(), postResponse.getStatus());
String path = postResponse.getLocation().getPath();
String putCode = path.substring(path.lastIndexOf('/') + 1, path.length());
ClientResponse getPeerReviewResponse = null;
if (readPublicToken != null) {
getPeerReviewResponse = publicV2ApiClient.viewPeerReviewXml(getUser1OrcidId(), putCode, readPublicToken);
} else {
getPeerReviewResponse = publicV2ApiClient.viewPeerReviewXml(getUser1OrcidId(), putCode);
}
assertNotNull(getPeerReviewResponse);
checkResponse(getPeerReviewResponse);
PeerReview peerReview = getPeerReviewResponse.getEntity(PeerReview.class);
assertNotNull(peerReview);
assertEquals("peer-review:url", peerReview.getUrl().getValue());
ClientResponse getPeerReviewSummaryResponse = publicV2ApiClient.viewPeerReviewSummaryXml(getUser1OrcidId(), putCode);
if (readPublicToken != null) {
getPeerReviewSummaryResponse = publicV2ApiClient.viewPeerReviewSummaryXml(getUser1OrcidId(), putCode, readPublicToken);
} else {
getPeerReviewSummaryResponse = publicV2ApiClient.viewPeerReviewSummaryXml(getUser1OrcidId(), putCode);
}
assertNotNull(getPeerReviewSummaryResponse);
checkResponse(getPeerReviewSummaryResponse);
PeerReviewSummary summary = getPeerReviewSummaryResponse.getEntity(PeerReviewSummary.class);
assertNotNull(summary);
assertEquals("1848", summary.getCompletionDate().getYear().getValue());
}
use of org.orcid.jaxb.model.record.summary_rc3.PeerReviewSummary in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest 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());
}
Aggregations