use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getPeerReviewMapperFacade.
public MapperFacade getPeerReviewMapperFacade() {
MapperFactory mapperFactory = getNewMapperFactory();
ConverterFactory converterFactory = mapperFactory.getConverterFactory();
converterFactory.registerConverter("workExternalIdentifiersConverterId", new JSONWorkExternalIdentifiersConverterV2());
converterFactory.registerConverter("workExternalIdentifierConverterId", new JSONPeerReviewWorkExternalIdentifierConverterV2());
// do same as work
ClassMapBuilder<PeerReview, PeerReviewEntity> classMap = mapperFactory.classMap(PeerReview.class, PeerReviewEntity.class);
addV2CommonFields(classMap);
registerSourceConverters(mapperFactory, classMap);
classMap.field("url.value", "url");
classMap.field("organization.name", "org.name");
classMap.field("organization.address.city", "org.city");
classMap.field("organization.address.region", "org.region");
classMap.field("organization.address.country", "org.country");
classMap.field("organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier", "org.orgDisambiguated.sourceId");
classMap.field("organization.disambiguatedOrganization.disambiguationSource", "org.orgDisambiguated.sourceType");
classMap.field("groupId", "groupId");
classMap.field("subjectType", "subjectType");
classMap.field("subjectUrl.value", "subjectUrl");
classMap.field("subjectName.title.content", "subjectName");
classMap.field("subjectName.translatedTitle.content", "subjectTranslatedName");
classMap.field("subjectName.translatedTitle.languageCode", "subjectTranslatedNameLanguageCode");
classMap.field("subjectContainerName.content", "subjectContainerName");
classMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
classMap.fieldMap("subjectExternalIdentifier", "subjectExternalIdentifiersJson").converter("workExternalIdentifierConverterId").add();
classMap.register();
ClassMapBuilder<PeerReviewSummary, PeerReviewEntity> peerReviewSummaryClassMap = mapperFactory.classMap(PeerReviewSummary.class, PeerReviewEntity.class);
addV2CommonFields(peerReviewSummaryClassMap);
registerSourceConverters(mapperFactory, peerReviewSummaryClassMap);
peerReviewSummaryClassMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
peerReviewSummaryClassMap.field("organization.name", "org.name");
peerReviewSummaryClassMap.field("organization.address.city", "org.city");
peerReviewSummaryClassMap.field("organization.address.region", "org.region");
peerReviewSummaryClassMap.field("organization.address.country", "org.country");
peerReviewSummaryClassMap.field("organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier", "org.orgDisambiguated.sourceId");
peerReviewSummaryClassMap.field("organization.disambiguatedOrganization.disambiguationSource", "org.orgDisambiguated.sourceType");
peerReviewSummaryClassMap.register();
mapperFactory.classMap(FuzzyDate.class, CompletionDateEntity.class).field("year.value", "year").field("month.value", "month").field("day.value", "day").register();
return mapperFactory.getMapperFacade();
}
use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getKeywordMapperFacade.
public MapperFacade getKeywordMapperFacade() {
MapperFactory mapperFactory = getNewMapperFactory();
ClassMapBuilder<Keyword, ProfileKeywordEntity> keywordClassMap = mapperFactory.classMap(Keyword.class, ProfileKeywordEntity.class);
addV2DateFields(keywordClassMap);
registerSourceConverters(mapperFactory, keywordClassMap);
keywordClassMap.field("putCode", "id");
keywordClassMap.field("content", "keywordName");
keywordClassMap.fieldBToA("displayIndex", "displayIndex");
keywordClassMap.byDefault();
keywordClassMap.register();
return mapperFactory.getMapperFacade();
}
use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getAddressMapperFacade.
public MapperFacade getAddressMapperFacade() {
MapperFactory mapperFactory = getNewMapperFactory();
ClassMapBuilder<Address, AddressEntity> addressClassMap = mapperFactory.classMap(Address.class, AddressEntity.class);
addV2DateFields(addressClassMap);
registerSourceConverters(mapperFactory, addressClassMap);
addressClassMap.field("putCode", "id");
addressClassMap.field("country.value", "iso2Country");
addressClassMap.field("visibility", "visibility");
addressClassMap.fieldBToA("displayIndex", "displayIndex");
addressClassMap.byDefault();
addressClassMap.register();
return mapperFactory.getMapperFacade();
}
use of ma.glasnost.orika.MapperFactory in project orika-spring-boot-starter by akihyro.
the class OrikaAutoConfiguration method orikaMapperFactory.
/**
* Creates a {@link MapperFactory}.
*
* @param orikaMapperFactoryBuilder the {@link MapperFactoryBuilder}.
* @return a {@link MapperFactory}.
*/
@ConditionalOnMissingBean
@Bean
public MapperFactory orikaMapperFactory(MapperFactoryBuilder<?, ?> orikaMapperFactoryBuilder) {
MapperFactory orikaMapperFactory = orikaMapperFactoryBuilder.build();
orikaMapperFactoryConfigurers.orElseGet(Collections::emptyList).forEach(configurer -> configurer.configure(orikaMapperFactory));
log.debug("Created a MapperFactory: [{}]", orikaMapperFactory);
return orikaMapperFactory;
}
use of ma.glasnost.orika.MapperFactory 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();
}
Aggregations