use of org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegatorImpl method viewEducationSummary.
@Override
public Response viewEducationSummary(String orcid, Long putCode) {
EducationSummary es = affiliationsManagerReadOnly.getEducationSummary(orcid, putCode);
orcidSecurityManager.checkAndFilter(orcid, es, ScopePathType.AFFILIATIONS_READ_LIMITED);
ActivityUtils.setPathToActivity(es, orcid);
sourceUtils.setSourceName(es);
return Response.ok(es).build();
}
use of org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_ActivitiesSummaryTest method testViewActitivies.
@Test
public void testViewActitivies() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewActivities(ORCID);
boolean found1 = false, found2 = false, found3 = false, found4 = false;
ActivitiesSummary as = (ActivitiesSummary) response.getEntity();
assertNotNull(as);
assertEquals("/0000-0000-0000-0003/activities", as.getPath());
Utils.verifyLastModified(as.getLastModifiedDate());
assertNotNull(as.getEducations());
assertEquals(4, as.getEducations().getSummaries().size());
for (EducationSummary element : as.getEducations().getSummaries()) {
if (element.getPutCode().equals(Long.valueOf(20))) {
found1 = true;
} else if (element.getPutCode().equals(Long.valueOf(21))) {
found2 = true;
} else if (element.getPutCode().equals(Long.valueOf(22))) {
found3 = true;
} else if (element.getPutCode().equals(Long.valueOf(25))) {
found4 = true;
} else {
fail("Invalid put code " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
found1 = found2 = found3 = found4 = false;
assertNotNull(as.getEmployments());
assertEquals(4, as.getEmployments().getSummaries().size());
for (EmploymentSummary element : as.getEmployments().getSummaries()) {
if (element.getPutCode().equals(Long.valueOf(17))) {
found1 = true;
} else if (element.getPutCode().equals(Long.valueOf(18))) {
found2 = true;
} else if (element.getPutCode().equals(Long.valueOf(19))) {
found3 = true;
} else if (element.getPutCode().equals(Long.valueOf(23))) {
found4 = true;
} else {
fail("Invalid put code " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
found1 = found2 = found3 = found4 = false;
assertNotNull(as.getFundings());
assertEquals(4, as.getFundings().getFundingGroup().size());
for (FundingGroup group : as.getFundings().getFundingGroup()) {
assertEquals(1, group.getFundingSummary().size());
FundingSummary element = group.getFundingSummary().get(0);
if (element.getPutCode().equals(Long.valueOf(10))) {
found1 = true;
} else if (element.getPutCode().equals(Long.valueOf(11))) {
found2 = true;
} else if (element.getPutCode().equals(Long.valueOf(12))) {
found3 = true;
} else if (element.getPutCode().equals(Long.valueOf(13))) {
found4 = true;
} else {
fail("Invalid put code " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
found1 = found2 = found3 = found4 = false;
assertNotNull(as.getPeerReviews());
assertEquals(4, as.getPeerReviews().getPeerReviewGroup().size());
for (PeerReviewGroup group : as.getPeerReviews().getPeerReviewGroup()) {
assertEquals(1, group.getPeerReviewSummary().size());
PeerReviewSummary element = group.getPeerReviewSummary().get(0);
if (element.getPutCode().equals(Long.valueOf(9))) {
found1 = true;
} else if (element.getPutCode().equals(Long.valueOf(10))) {
found2 = true;
} else if (element.getPutCode().equals(Long.valueOf(11))) {
found3 = true;
} else if (element.getPutCode().equals(Long.valueOf(12))) {
found4 = true;
} else {
fail("Invalid put code " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
found1 = found2 = found3 = found4 = false;
assertNotNull(as.getWorks());
assertEquals(4, as.getWorks().getWorkGroup().size());
for (WorkGroup group : as.getWorks().getWorkGroup()) {
assertEquals(1, group.getWorkSummary().size());
WorkSummary element = group.getWorkSummary().get(0);
if (element.getPutCode().equals(Long.valueOf(11))) {
found1 = true;
} else if (element.getPutCode().equals(Long.valueOf(12))) {
found2 = true;
} else if (element.getPutCode().equals(Long.valueOf(13))) {
found3 = true;
} else if (element.getPutCode().equals(Long.valueOf(14))) {
found4 = true;
} else {
fail("Invalid put code " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
}
use of org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_EducationsTest method testViewEducationSummaryReadPublic.
@Test
public void testViewEducationSummaryReadPublic() {
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewEducationSummary(ORCID, 20L);
EducationSummary element = (EducationSummary) r.getEntity();
assertNotNull(element);
assertEquals("/0000-0000-0000-0003/education/20", element.getPath());
Utils.assertIsPublicOrSource(element, "APP-5555555555555555");
}
use of org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_EducationsTest method testViewEducations.
@Test
public void testViewEducations() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response r = serviceDelegator.viewEducations(ORCID);
assertNotNull(r);
Educations educations = (Educations) r.getEntity();
assertNotNull(educations);
assertEquals("/0000-0000-0000-0003/educations", educations.getPath());
Utils.verifyLastModified(educations.getLastModifiedDate());
assertNotNull(educations.getSummaries());
assertEquals(4, educations.getSummaries().size());
boolean found1 = false, found2 = false, found3 = false, found4 = false;
for (EducationSummary summary : educations.getSummaries()) {
Utils.verifyLastModified(summary.getLastModifiedDate());
if (Long.valueOf(20).equals(summary.getPutCode())) {
assertEquals("PUBLIC Department", summary.getDepartmentName());
found1 = true;
} else if (Long.valueOf(21).equals(summary.getPutCode())) {
assertEquals("LIMITED Department", summary.getDepartmentName());
found2 = true;
} else if (Long.valueOf(22).equals(summary.getPutCode())) {
assertEquals("PRIVATE Department", summary.getDepartmentName());
found3 = true;
} else if (Long.valueOf(25).equals(summary.getPutCode())) {
assertEquals("SELF LIMITED Department", summary.getDepartmentName());
found4 = true;
} else {
fail("Invalid education found: " + summary.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
}
use of org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_ReadRecordTest method testActivities.
private void testActivities(ActivitiesSummary as, String orcid) {
boolean found1 = false, found2 = false, found3 = false;
// This is more an utility that will work only for 0000-0000-0000-0003
assertEquals("0000-0000-0000-0003", orcid);
assertNotNull(as);
assertEquals("/0000-0000-0000-0003/activities", as.getPath());
Utils.verifyLastModified(as.getLastModifiedDate());
assertNotNull(as.getEducations());
assertEquals(3, as.getEducations().getSummaries().size());
for (EducationSummary element : as.getEducations().getSummaries()) {
if (element.getPutCode().equals(Long.valueOf(20))) {
found1 = true;
} else if (element.getPutCode().equals(Long.valueOf(21))) {
found2 = true;
} else if (element.getPutCode().equals(Long.valueOf(22))) {
found3 = true;
} else {
fail("Invalid put code " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
found1 = found2 = found3 = false;
assertNotNull(as.getEmployments());
assertEquals(3, as.getEmployments().getSummaries().size());
for (EmploymentSummary element : as.getEmployments().getSummaries()) {
if (element.getPutCode().equals(Long.valueOf(17))) {
found1 = true;
} else if (element.getPutCode().equals(Long.valueOf(18))) {
found2 = true;
} else if (element.getPutCode().equals(Long.valueOf(19))) {
found3 = true;
} else {
fail("Invalid put code " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
found1 = found2 = found3 = false;
assertNotNull(as.getFundings());
assertEquals(3, as.getFundings().getFundingGroup().size());
for (FundingGroup group : as.getFundings().getFundingGroup()) {
assertEquals(1, group.getFundingSummary().size());
FundingSummary element = group.getFundingSummary().get(0);
if (element.getPutCode().equals(Long.valueOf(10))) {
found1 = true;
} else if (element.getPutCode().equals(Long.valueOf(11))) {
found2 = true;
} else if (element.getPutCode().equals(Long.valueOf(12))) {
found3 = true;
} else {
fail("Invalid put code " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
found1 = found2 = found3 = false;
assertNotNull(as.getPeerReviews());
assertEquals(3, as.getPeerReviews().getPeerReviewGroup().size());
for (PeerReviewGroup group : as.getPeerReviews().getPeerReviewGroup()) {
assertEquals(1, group.getPeerReviewSummary().size());
PeerReviewSummary element = group.getPeerReviewSummary().get(0);
if (element.getPutCode().equals(Long.valueOf(9))) {
found1 = true;
} else if (element.getPutCode().equals(Long.valueOf(10))) {
found2 = true;
} else if (element.getPutCode().equals(Long.valueOf(11))) {
found3 = true;
} else {
fail("Invalid put code " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
found1 = found2 = found3 = false;
assertNotNull(as.getWorks());
assertEquals(3, as.getWorks().getWorkGroup().size());
for (WorkGroup group : as.getWorks().getWorkGroup()) {
assertEquals(1, group.getWorkSummary().size());
WorkSummary element = group.getWorkSummary().get(0);
if (element.getPutCode().equals(Long.valueOf(11))) {
found1 = true;
} else if (element.getPutCode().equals(Long.valueOf(12))) {
found2 = true;
} else if (element.getPutCode().equals(Long.valueOf(13))) {
found3 = true;
} else {
fail("Invalid put code " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
found1 = found2 = found3 = false;
}
Aggregations