use of org.orcid.jaxb.model.record.summary_rc2.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_rc2.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_rc2.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_rc2.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());
}
use of org.orcid.jaxb.model.record.summary_rc2.Educations in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testViewEducations.
@Test
public void testViewEducations() {
Response response = serviceDelegator.viewEducations(ORCID);
assertNotNull(response);
Educations educations = (Educations) response.getEntity();
assertNotNull(educations);
assertEquals("/0000-0000-0000-0003/educations", educations.getPath());
assertNotNull(educations.getLastModifiedDate());
assertNotNull(educations.getLastModifiedDate().getValue());
assertEquals(1, educations.getSummaries().size());
EducationSummary education = educations.getSummaries().get(0);
assertEquals(Long.valueOf(20), education.getPutCode());
assertNotNull(education.getLastModifiedDate());
assertNotNull(education.getLastModifiedDate().getValue());
assertEquals("/0000-0000-0000-0003/education/20", education.getPath());
assertEquals("PUBLIC Department", education.getDepartmentName());
assertEquals(Visibility.PUBLIC.value(), education.getVisibility().value());
assertEquals("APP-5555555555555555", education.getSource().retrieveSourcePath());
}
Aggregations