use of org.orcid.jaxb.model.record_rc1.Employment in project ORCID-Source by ORCID.
the class JpaJaxbEmploymentAdapterTest method testToOrgAffiliationRelationEntity.
@Test
public void testToOrgAffiliationRelationEntity() throws JAXBException {
Employment e = getEmployment(true);
assertNotNull(e);
OrgAffiliationRelationEntity oar = jpaJaxbEmploymentAdapter.toOrgAffiliationRelationEntity(e);
assertNotNull(oar);
// General info
assertEquals(Long.valueOf(0), oar.getId());
assertEquals(Visibility.PRIVATE.value(), oar.getVisibility().value());
assertEquals("employment:department-name", oar.getDepartment());
assertEquals("employment: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());
}
use of org.orcid.jaxb.model.record_rc1.Employment in project ORCID-Source by ORCID.
the class JpaJaxbEmploymentAdapterTest method testToOrgAffiliationRelationEntityWithNullMonthAndDay.
@Test
public void testToOrgAffiliationRelationEntityWithNullMonthAndDay() throws JAXBException {
Employment e = getEmploymentWithDates();
OrgAffiliationRelationEntity oar = jpaJaxbEmploymentAdapter.toOrgAffiliationRelationEntity(e);
assertNotNull(oar.getStartDate().getYear());
assertNotNull(oar.getStartDate().getMonth());
assertNotNull(oar.getStartDate().getDay());
e = getEmploymentWithDatesWithNullMonthAndDay();
oar = jpaJaxbEmploymentAdapter.toOrgAffiliationRelationEntity(e, oar);
assertNotNull(oar.getStartDate().getYear());
assertNull(oar.getStartDate().getMonth());
assertNull(oar.getStartDate().getDay());
}
use of org.orcid.jaxb.model.record_rc1.Employment in project ORCID-Source by ORCID.
the class JpaJaxbEmploymentAdapterTest method getEmploymentWithDates.
private Employment getEmploymentWithDates() {
Employment employment = new Employment();
employment.setRoleTitle("role title");
FuzzyDate startDate = new FuzzyDate(new Year(2017), new Month(1), new Day(1));
FuzzyDate endDate = new FuzzyDate(new Year(2017), new Month(3), new Day(1));
employment.setStartDate(startDate);
employment.setEndDate(endDate);
return employment;
}
use of org.orcid.jaxb.model.record_rc1.Employment in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateEmployment_validEmploymentTest.
/**
* VALIDATE AFFILIATIONS
*/
@Test
public void validateEmployment_validEmploymentTest() {
Employment employment = getEmployment();
activityValidator.validateEmployment(employment, null, true, true, Visibility.PUBLIC);
}
use of org.orcid.jaxb.model.record_rc1.Employment in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getEmploymentMapperFacade.
public MapperFacade getEmploymentMapperFacade() {
MapperFactory mapperFactory = getNewMapperFactory();
ClassMapBuilder<Employment, OrgAffiliationRelationEntity> classMap = mapperFactory.classMap(Employment.class, OrgAffiliationRelationEntity.class);
addV2CommonFields(classMap);
registerSourceConverters(mapperFactory, classMap);
classMap.fieldBToA("org.name", "organization.name");
classMap.fieldBToA("org.city", "organization.address.city");
classMap.fieldBToA("org.region", "organization.address.region");
classMap.fieldBToA("org.country", "organization.address.country");
classMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
classMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
classMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
classMap.field("departmentName", "department");
classMap.field("roleTitle", "title");
classMap.register();
ClassMapBuilder<EmploymentSummary, OrgAffiliationRelationEntity> employmentSummaryClassMap = mapperFactory.classMap(EmploymentSummary.class, OrgAffiliationRelationEntity.class);
addV2CommonFields(employmentSummaryClassMap);
registerSourceConverters(mapperFactory, employmentSummaryClassMap);
employmentSummaryClassMap.fieldBToA("org.name", "organization.name");
employmentSummaryClassMap.fieldBToA("org.city", "organization.address.city");
employmentSummaryClassMap.fieldBToA("org.region", "organization.address.region");
employmentSummaryClassMap.fieldBToA("org.country", "organization.address.country");
employmentSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
employmentSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
employmentSummaryClassMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
employmentSummaryClassMap.field("departmentName", "department");
employmentSummaryClassMap.field("roleTitle", "title");
employmentSummaryClassMap.register();
mapFuzzyDateToStartDateEntityAndEndDateEntity(mapperFactory);
return mapperFactory.getMapperFacade();
}
Aggregations