use of org.orcid.jaxb.model.record_rc3.Education in project ORCID-Source by ORCID.
the class BlackBoxBaseV2Release method unmarshallFromPath.
public Object unmarshallFromPath(String path, Class<?> type) {
try (Reader reader = new InputStreamReader(getClass().getResourceAsStream(path))) {
Object obj = unmarshall(reader, type);
Object result = null;
if (Address.class.equals(type)) {
result = (Address) obj;
} else if (Education.class.equals(type)) {
result = (Education) obj;
} else if (Employment.class.equals(type)) {
result = (Employment) obj;
} else if (Funding.class.equals(type)) {
result = (Funding) obj;
} else if (Keyword.class.equals(type)) {
result = (Keyword) obj;
} else if (Work.class.equals(type)) {
result = (Work) obj;
} else if (PeerReview.class.equals(type)) {
result = (PeerReview) obj;
} else if (ResearcherUrl.class.equals(type)) {
result = (ResearcherUrl) obj;
} else if (PersonalDetails.class.equals(type)) {
result = (PersonalDetails) obj;
} else if (OtherName.class.equals(type)) {
result = (OtherName) obj;
} else if (PersonExternalIdentifier.class.equals(type)) {
result = (PersonExternalIdentifier) obj;
}
return result;
} catch (IOException e) {
throw new RuntimeException("Error reading notification from classpath", e);
}
}
use of org.orcid.jaxb.model.record_rc3.Education in project ORCID-Source by ORCID.
the class SourceInActivitiesTest method getEducation.
private Education getEducation(String userOrcid) {
Education education = new Education();
education.setOrganization(getOrganization());
education = affiliationsManager.createEducationAffiliation(userOrcid, education, true);
return affiliationsManager.getEducationAffiliation(userOrcid, education.getPutCode());
}
use of org.orcid.jaxb.model.record_rc3.Education in project ORCID-Source by ORCID.
the class SourceInActivitiesTest method getAffiliationWithPutCode.
private Education getAffiliationWithPutCode(String userOrcid) {
Education education = new Education();
education.setOrganization(getOrganization());
education.setPutCode(Long.valueOf(111));
education = affiliationsManager.createEducationAffiliation(userOrcid, education, true);
return affiliationsManager.getEducationAffiliation(userOrcid, education.getPutCode());
}
use of org.orcid.jaxb.model.record_rc3.Education in project ORCID-Source by ORCID.
the class JpaJaxbEducationAdapterTest method fromOrgAffiliationRelationEntityToEducation.
@Test
public void fromOrgAffiliationRelationEntityToEducation() {
OrgAffiliationRelationEntity entity = getEducationEntity();
assertNotNull(entity);
Education education = jpaJaxbEducationAdapter.toEducation(entity);
assertNotNull(education);
assertEquals("education:department", education.getDepartmentName());
assertEquals(Long.valueOf(123456), education.getPutCode());
assertEquals("education:title", education.getRoleTitle());
assertEquals("private", education.getVisibility().value());
assertNotNull(education.getStartDate());
assertEquals("2000", education.getStartDate().getYear().getValue());
assertEquals("01", education.getStartDate().getMonth().getValue());
assertEquals("01", education.getStartDate().getDay().getValue());
assertEquals("2020", education.getEndDate().getYear().getValue());
assertEquals("02", education.getEndDate().getMonth().getValue());
assertEquals("02", education.getEndDate().getDay().getValue());
assertNotNull(education.getOrganization());
assertEquals("org:name", education.getOrganization().getName());
assertNotNull(education.getOrganization().getAddress());
assertEquals("org:city", education.getOrganization().getAddress().getCity());
assertEquals("org:region", education.getOrganization().getAddress().getRegion());
assertEquals(org.orcid.jaxb.model.common_v2.Iso3166Country.US, education.getOrganization().getAddress().getCountry());
assertNotNull(education.getSource());
assertNotNull(education.getSource().retrieveSourcePath());
assertEquals("APP-000000001", education.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.record_rc3.Education in project ORCID-Source by ORCID.
the class JpaJaxbEducationAdapterTest method testToOrgAffiliationRelationEntity.
@Test
public void testToOrgAffiliationRelationEntity() throws JAXBException {
Education e = getEducation(true);
assertNotNull(e);
OrgAffiliationRelationEntity oar = jpaJaxbEducationAdapter.toOrgAffiliationRelationEntity(e);
assertNotNull(oar);
//General info
assertEquals(Long.valueOf(0), oar.getId());
assertEquals(Visibility.PRIVATE.value(), oar.getVisibility().value());
assertEquals("education:department-name", oar.getDepartment());
assertEquals("education:role-title", oar.getTitle());
//Dates
assertEquals(Integer.valueOf(2), oar.getStartDate().getDay());
assertEquals(Integer.valueOf(2), oar.getStartDate().getMonth());
assertEquals(Integer.valueOf(1848), oar.getStartDate().getYear());
assertEquals(Integer.valueOf(2), oar.getEndDate().getDay());
assertEquals(Integer.valueOf(2), oar.getEndDate().getMonth());
assertEquals(Integer.valueOf(1848), oar.getEndDate().getYear());
// Source
assertNull(oar.getSourceId());
assertNull(oar.getClientSourceId());
assertNull(oar.getElementSourceId());
}
Aggregations