use of org.orcid.persistence.jpa.entities.RecordNameEntity in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getNameMapperFacade.
public MapperFacade getNameMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<Name, RecordNameEntity> nameClassMap = mapperFactory.classMap(Name.class, RecordNameEntity.class);
addV2DateFields(nameClassMap);
nameClassMap.field("creditName.content", "creditName");
nameClassMap.field("givenNames.content", "givenNames");
nameClassMap.field("familyName.content", "familyName");
nameClassMap.field("path", "profile.id");
nameClassMap.byDefault();
nameClassMap.register();
return mapperFactory.getMapperFacade();
}
use of org.orcid.persistence.jpa.entities.RecordNameEntity in project ORCID-Source by ORCID.
the class Jpa2JaxbAdapterImpl method getFamilyName.
private FamilyName getFamilyName(ProfileEntity profileEntity) {
RecordNameEntity recordName = profileEntity.getRecordNameEntity();
if (recordName != null) {
if (StringUtils.isNotBlank(recordName.getFamilyName())) {
FamilyName name = new FamilyName();
name.setContent(recordName.getFamilyName());
name.setVisibility(recordName.getVisibility() == null ? OrcidVisibilityDefaults.NAMES_DEFAULT.getVisibility() : Visibility.fromValue(recordName.getVisibility().value()));
return name;
}
}
return null;
}
use of org.orcid.persistence.jpa.entities.RecordNameEntity in project ORCID-Source by ORCID.
the class Jpa2JaxbAdapterImpl method getGivenNames.
private GivenNames getGivenNames(ProfileEntity profileEntity) {
RecordNameEntity recordName = profileEntity.getRecordNameEntity();
if (recordName != null) {
if (StringUtils.isNotBlank(recordName.getGivenNames())) {
GivenNames names = new GivenNames();
names.setContent(recordName.getGivenNames());
names.setVisibility(recordName.getVisibility() == null ? OrcidVisibilityDefaults.NAMES_DEFAULT.getVisibility() : Visibility.fromValue(recordName.getVisibility().value()));
return names;
}
}
return null;
}
use of org.orcid.persistence.jpa.entities.RecordNameEntity in project ORCID-Source by ORCID.
the class Jpa2JaxbAdapterImpl method getCreditName.
private CreditName getCreditName(ProfileEntity profileEntity) {
RecordNameEntity recordName = profileEntity.getRecordNameEntity();
if (recordName != null) {
if (StringUtils.isNotBlank(recordName.getCreditName())) {
CreditName name = new CreditName();
name.setContent(recordName.getCreditName());
name.setVisibility(recordName.getVisibility() == null ? OrcidVisibilityDefaults.NAMES_DEFAULT.getVisibility() : Visibility.fromValue(recordName.getVisibility().value()));
return name;
}
}
return null;
}
use of org.orcid.persistence.jpa.entities.RecordNameEntity in project ORCID-Source by ORCID.
the class Jaxb2JpaAdapterImpl method setCreditNameDetails.
private void setCreditNameDetails(ProfileEntity profileEntity, CreditName creditName) {
if (creditName != null) {
if (profileEntity.getRecordNameEntity() == null) {
profileEntity.setRecordNameEntity(new RecordNameEntity());
profileEntity.getRecordNameEntity().setProfile(profileEntity);
}
RecordNameEntity recordName = profileEntity.getRecordNameEntity();
//Save the record name entity
if (creditName.getVisibility() != null) {
recordName.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(creditName.getVisibility().value()));
} else {
recordName.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(OrcidVisibilityDefaults.NAMES_DEFAULT.getVisibility().value()));
}
recordName.setCreditName(creditName.getContent());
}
}
Aggregations