use of org.orcid.persistence.jpa.entities.ResearcherUrlEntity in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getResearcherUrlMapperFacade.
public MapperFacade getResearcherUrlMapperFacade() {
MapperFactory mapperFactory = getNewMapperFactory();
ClassMapBuilder<ResearcherUrl, ResearcherUrlEntity> researcherUrlClassMap = mapperFactory.classMap(ResearcherUrl.class, ResearcherUrlEntity.class);
addV2DateFields(researcherUrlClassMap);
registerSourceConverters(mapperFactory, researcherUrlClassMap);
researcherUrlClassMap.field("putCode", "id");
researcherUrlClassMap.field("url.value", "url");
researcherUrlClassMap.field("urlName", "urlName");
researcherUrlClassMap.fieldBToA("displayIndex", "displayIndex");
researcherUrlClassMap.byDefault();
researcherUrlClassMap.register();
return mapperFactory.getMapperFacade();
}
use of org.orcid.persistence.jpa.entities.ResearcherUrlEntity in project ORCID-Source by ORCID.
the class Jpa2JaxbAdapterImpl method getResearcherUrls.
private ResearcherUrls getResearcherUrls(ProfileEntity profileEntity) {
Set<ResearcherUrlEntity> researcherUrlEntities = profileEntity.getResearcherUrls();
if (researcherUrlEntities != null) {
ResearcherUrls researcherUrls = new ResearcherUrls();
Visibility mostRestrictive = Visibility.PUBLIC;
for (ResearcherUrlEntity researcherUrl : researcherUrlEntities) {
// will only be null if there's an issue with the data or you're using this layer directly
Visibility vis = (researcherUrl.getVisibility() != null) ? Visibility.fromValue(researcherUrl.getVisibility().value()) : Visibility.PRIVATE;
if (vis.isMoreRestrictiveThan(mostRestrictive))
mostRestrictive = vis;
ResearcherUrl url = new ResearcherUrl(new Url(researcherUrl.getUrl()), vis);
if (!StringUtils.isBlank(researcherUrl.getUrlName()))
url.setUrlName(new UrlName(researcherUrl.getUrlName()));
if (!PojoUtil.isEmpty(researcherUrl.getElementSourceId())) {
Source source = getSource(researcherUrl);
url.setSource(source);
}
researcherUrls.setVisibility(mostRestrictive);
researcherUrls.getResearcherUrl().add(url);
}
return researcherUrls;
}
return null;
}
use of org.orcid.persistence.jpa.entities.ResearcherUrlEntity in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getResearcherUrlMapperFacade.
public MapperFacade getResearcherUrlMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<ResearcherUrl, ResearcherUrlEntity> researcherUrlClassMap = mapperFactory.classMap(ResearcherUrl.class, ResearcherUrlEntity.class);
addV3DateFields(researcherUrlClassMap);
registerSourceConverters(mapperFactory, researcherUrlClassMap);
researcherUrlClassMap.field("putCode", "id");
researcherUrlClassMap.field("url.value", "url");
researcherUrlClassMap.field("urlName", "urlName");
researcherUrlClassMap.fieldBToA("displayIndex", "displayIndex");
researcherUrlClassMap.byDefault();
researcherUrlClassMap.register();
return mapperFactory.getMapperFacade();
}
Aggregations