use of org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity in project ORCID-Source by ORCID.
the class Jaxb2JpaAdapterImpl method getUpdatedAffiliationRelationEntity.
@Override
public OrgAffiliationRelationEntity getUpdatedAffiliationRelationEntity(Affiliation updatedAffiliation) {
if (PojoUtil.isEmpty(updatedAffiliation.getPutCode()))
throw new IllegalArgumentException("Affiliation must contain a put code to be edited");
long affiliationId = Long.valueOf(updatedAffiliation.getPutCode());
OrgAffiliationRelationEntity exisitingOrgAffiliationEntity = orgAffiliationRelationDao.find(affiliationId);
OrgAffiliationRelationEntity orgAffiliationRelationEntity = getOrgAffiliationRelationEntity(updatedAffiliation, exisitingOrgAffiliationEntity);
return orgAffiliationRelationEntity;
}
use of org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity in project ORCID-Source by ORCID.
the class Jpa2JaxbAdapterImpl method getAffiliations.
private Affiliations getAffiliations(ProfileEntity profileEntity) {
LOGGER.debug("About to convert affiliations from entity: " + profileEntity.getId());
Set<OrgAffiliationRelationEntity> orgRelationEntities = profileEntity.getOrgAffiliationRelations();
if (orgRelationEntities != null && !orgRelationEntities.isEmpty()) {
Affiliations affiliations = new Affiliations();
List<Affiliation> affiliationList = affiliations.getAffiliation();
for (OrgAffiliationRelationEntity orgRelationEntity : orgRelationEntities) {
affiliationList.add(getAffiliation(orgRelationEntity));
}
return affiliations;
}
return null;
}
use of org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getEducationMapperFacade.
public MapperFacade getEducationMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<Education, OrgAffiliationRelationEntity> educationClassMap = mapperFactory.classMap(Education.class, OrgAffiliationRelationEntity.class);
addV2CommonFields(educationClassMap);
registerSourceConverters(mapperFactory, educationClassMap);
educationClassMap.fieldBToA("org.name", "organization.name");
educationClassMap.fieldBToA("org.city", "organization.address.city");
educationClassMap.fieldBToA("org.region", "organization.address.region");
educationClassMap.fieldBToA("org.country", "organization.address.country");
educationClassMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
educationClassMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
educationClassMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
educationClassMap.field("departmentName", "department");
educationClassMap.field("roleTitle", "title");
educationClassMap.register();
ClassMapBuilder<EducationSummary, OrgAffiliationRelationEntity> educationSummaryClassMap = mapperFactory.classMap(EducationSummary.class, OrgAffiliationRelationEntity.class);
addV2CommonFields(educationSummaryClassMap);
registerSourceConverters(mapperFactory, educationSummaryClassMap);
educationSummaryClassMap.fieldBToA("org.name", "organization.name");
educationSummaryClassMap.fieldBToA("org.city", "organization.address.city");
educationSummaryClassMap.fieldBToA("org.region", "organization.address.region");
educationSummaryClassMap.fieldBToA("org.country", "organization.address.country");
educationSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
educationSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
educationSummaryClassMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
educationSummaryClassMap.field("departmentName", "department");
educationSummaryClassMap.field("roleTitle", "title");
educationSummaryClassMap.register();
mapperFactory.classMap(FuzzyDate.class, StartDateEntity.class).field("year.value", "year").field("month.value", "month").field("day.value", "day").register();
mapperFactory.classMap(FuzzyDate.class, EndDateEntity.class).field("year.value", "year").field("month.value", "month").field("day.value", "day").register();
return mapperFactory.getMapperFacade();
}
Aggregations