use of org.orcid.jaxb.model.record.summary_rc1.Educations in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method viewEducations.
@Override
public Response viewEducations(String orcid) {
List<EducationSummary> educationsList = affiliationsManagerReadOnly.getEducationSummaryList(orcid);
// Lets copy the list so we don't modify the cached collection
List<EducationSummary> filteredList = null;
if (educationsList != null) {
filteredList = new ArrayList<EducationSummary>(educationsList);
}
educationsList = filteredList;
orcidSecurityManager.checkAndFilter(orcid, educationsList, ScopePathType.AFFILIATIONS_READ_LIMITED);
Educations educations = new Educations(educationsList);
ActivityUtils.setPathToEducations(educations, orcid);
sourceUtils.setSourceName(educations);
Api2_0_LastModifiedDatesHelper.calculateLastModified(educations);
return Response.ok(educations).build();
}
use of org.orcid.jaxb.model.record.summary_rc1.Educations 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_rc1.Educations in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EducationsTest method testViewEducationsReadPublic.
@Test
public void testViewEducationsReadPublic() {
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewEducations(ORCID);
Educations element = (Educations) r.getEntity();
assertNotNull(element);
assertEquals("/0000-0000-0000-0003/educations", element.getPath());
Utils.assertIsPublicOrSource(element, "APP-5555555555555555");
}
use of org.orcid.jaxb.model.record.summary_rc1.Educations in project ORCID-Source by ORCID.
the class ConvertVrc4ToV2Test method upgradeEducationsToVrc3Test.
@Test
public void upgradeEducationsToVrc3Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(Educations.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_v2.Educations.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream rc3Stream = ConvertVrc4ToV2Test.class.getClassLoader().getResourceAsStream("test-educations-2.0_rc4.xml");
InputStream rc4Stream = ConvertVrc4ToV2Test.class.getClassLoader().getResourceAsStream("test-educations-2.0.xml");
Educations rc4Educations = (Educations) jaxbUnmarshaller.unmarshal(rc3Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
org.orcid.jaxb.model.record.summary_v2.Educations rc4Educations1 = (org.orcid.jaxb.model.record.summary_v2.Educations) jaxbUnmarshaller.unmarshal(rc4Stream);
V2Convertible result = versionConverterV2_0_rc4ToV2_0.upgrade(new V2Convertible(rc4Educations, "v2_rc4"));
org.orcid.jaxb.model.record.summary_v2.Educations rc4Educations2 = (org.orcid.jaxb.model.record.summary_v2.Educations) result.getObjectToConvert();
assertEquals(rc4Educations1, rc4Educations2);
}
use of org.orcid.jaxb.model.record.summary_rc1.Educations in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV2Test method filterEducationsTest.
@Test
public void filterEducationsTest() {
Educations e = getEducations(Visibility.PUBLIC, Visibility.PUBLIC, Visibility.PUBLIC);
assertEquals(3, e.getSummaries().size());
publicAPISecurityManagerV2.filter(e);
assertEquals(3, e.getSummaries().size());
assertContainerContainsOnlyPublicElements(e);
e = getEducations(Visibility.PUBLIC, Visibility.PUBLIC, Visibility.LIMITED);
assertEquals(3, e.getSummaries().size());
publicAPISecurityManagerV2.filter(e);
assertEquals(2, e.getSummaries().size());
assertContainerContainsOnlyPublicElements(e);
e = getEducations(Visibility.PUBLIC, Visibility.LIMITED, Visibility.PRIVATE);
assertEquals(3, e.getSummaries().size());
publicAPISecurityManagerV2.filter(e);
assertEquals(1, e.getSummaries().size());
assertContainerContainsOnlyPublicElements(e);
e = getEducations(Visibility.LIMITED, Visibility.LIMITED, Visibility.PRIVATE);
assertEquals(3, e.getSummaries().size());
publicAPISecurityManagerV2.filter(e);
assertTrue(e.getSummaries().isEmpty());
}
Aggregations