use of ma.glasnost.orika.MapperFactory in project Saturn by vipshop.
the class MapperFactoryBean method getObject.
@Override
public MapperFactory getObject() throws Exception {
MapperFactory factory = new DefaultMapperFactory.Builder().build();
factory.classMap(JobSettings.class, CurrentJobConfig.class).mapNulls(false).byDefault().register();
factory.classMap(JobConfig.class, CurrentJobConfig.class).mapNulls(false).byDefault().register();
factory.classMap(CurrentJobConfig.class, HistoryJobConfig.class).mapNulls(false).byDefault().register();
return factory;
}
use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.
the class SalesForceMapperFacadeFactory method getMemberMapperFacade.
public MapperFacade getMemberMapperFacade() throws Exception {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().propertyResolverStrategy(new JSONPropertyResolver()).build();
ConverterFactory converterFactory = mapperFactory.getConverterFactory();
converterFactory.registerConverter(new StringConverter());
converterFactory.registerConverter(new URLConverter());
converterFactory.registerConverter(new ReverseURLConverter());
registerMemberMap(mapperFactory);
registerOpportunityMap(mapperFactory);
registerContactMap(mapperFactory);
registerContactRoleMap(mapperFactory);
registerOpportunityContactRoleMap(mapperFactory);
registerOrgIdMap(mapperFactory);
return mapperFactory.getMapperFacade();
}
use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getWorkMapperFacade.
public MapperFacade getWorkMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ConverterFactory converterFactory = mapperFactory.getConverterFactory();
converterFactory.registerConverter("workExternalIdentifiersConverterId", new JSONWorkExternalIdentifiersConverterV3(norm, localeManager));
converterFactory.registerConverter("workContributorsConverterId", new JsonOrikaConverter<WorkContributors>());
ClassMapBuilder<Work, WorkEntity> workClassMap = mapperFactory.classMap(Work.class, WorkEntity.class);
workClassMap.byDefault();
workClassMap.field("putCode", "id");
addV3DateFields(workClassMap);
registerSourceConverters(mapperFactory, workClassMap);
workClassMap.field("journalTitle.content", "journalTitle");
workClassMap.field("workTitle.title.content", "title");
workClassMap.field("workTitle.translatedTitle.content", "translatedTitle");
workClassMap.field("workTitle.translatedTitle.languageCode", "translatedTitleLanguageCode");
workClassMap.field("workTitle.subtitle.content", "subtitle");
workClassMap.field("shortDescription", "description");
workClassMap.field("workCitation.workCitationType", "citationType");
workClassMap.field("workCitation.citation", "citation");
workClassMap.field("workType", "workType");
workClassMap.field("publicationDate", "publicationDate");
workClassMap.fieldMap("workExternalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
workClassMap.field("url.value", "workUrl");
workClassMap.fieldMap("workContributors", "contributorsJson").converter("workContributorsConverterId").add();
workClassMap.field("languageCode", "languageCode");
workClassMap.field("country.value", "iso2Country");
workClassMap.register();
ClassMapBuilder<WorkSummary, WorkEntity> workSummaryClassMap = mapperFactory.classMap(WorkSummary.class, WorkEntity.class);
registerSourceConverters(mapperFactory, workSummaryClassMap);
workSummaryClassMap.field("putCode", "id");
workSummaryClassMap.field("title.title.content", "title");
workSummaryClassMap.field("title.translatedTitle.content", "translatedTitle");
workSummaryClassMap.field("title.translatedTitle.languageCode", "translatedTitleLanguageCode");
workSummaryClassMap.field("journalTitle.content", "journalTitle");
workSummaryClassMap.field("type", "workType");
workSummaryClassMap.field("publicationDate", "publicationDate");
workSummaryClassMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
workSummaryClassMap.byDefault();
workSummaryClassMap.register();
ClassMapBuilder<WorkSummary, MinimizedWorkEntity> workSummaryMinimizedClassMap = mapperFactory.classMap(WorkSummary.class, MinimizedWorkEntity.class);
addV3CommonFields(workSummaryMinimizedClassMap);
registerSourceConverters(mapperFactory, workSummaryMinimizedClassMap);
workSummaryMinimizedClassMap.field("title.title.content", "title");
workSummaryMinimizedClassMap.field("title.translatedTitle.content", "translatedTitle");
workSummaryMinimizedClassMap.field("title.translatedTitle.languageCode", "translatedTitleLanguageCode");
workSummaryMinimizedClassMap.field("type", "workType");
workSummaryMinimizedClassMap.field("publicationDate.year.value", "publicationYear");
workSummaryMinimizedClassMap.field("publicationDate.month.value", "publicationMonth");
workSummaryMinimizedClassMap.field("publicationDate.day.value", "publicationDay");
workSummaryMinimizedClassMap.fieldMap("externalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
workSummaryMinimizedClassMap.byDefault();
workSummaryMinimizedClassMap.register();
ClassMapBuilder<Work, MinimizedWorkEntity> minimizedWorkClassMap = mapperFactory.classMap(Work.class, MinimizedWorkEntity.class);
minimizedWorkClassMap.byDefault();
registerSourceConverters(mapperFactory, minimizedWorkClassMap);
minimizedWorkClassMap.field("putCode", "id");
minimizedWorkClassMap.field("journalTitle.content", "journalTitle");
minimizedWorkClassMap.field("workTitle.title.content", "title");
minimizedWorkClassMap.field("workTitle.translatedTitle.content", "translatedTitle");
minimizedWorkClassMap.field("workTitle.translatedTitle.languageCode", "translatedTitleLanguageCode");
minimizedWorkClassMap.field("workTitle.subtitle.content", "subtitle");
minimizedWorkClassMap.field("shortDescription", "description");
minimizedWorkClassMap.field("workType", "workType");
minimizedWorkClassMap.field("publicationDate.year.value", "publicationYear");
minimizedWorkClassMap.field("publicationDate.month.value", "publicationMonth");
minimizedWorkClassMap.field("publicationDate.day.value", "publicationDay");
minimizedWorkClassMap.fieldMap("workExternalIdentifiers", "externalIdentifiersJson").converter("workExternalIdentifiersConverterId").add();
minimizedWorkClassMap.field("url.value", "workUrl");
minimizedWorkClassMap.register();
mapperFactory.classMap(PublicationDate.class, PublicationDateEntity.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 getQualificationMapperFacade.
public MapperFacade getQualificationMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<Qualification, OrgAffiliationRelationEntity> classMap = mapperFactory.classMap(Qualification.class, OrgAffiliationRelationEntity.class);
ClassMapBuilder<QualificationSummary, OrgAffiliationRelationEntity> summaryClassMap = mapperFactory.classMap(QualificationSummary.class, OrgAffiliationRelationEntity.class);
return generateMapperFacadeForAffiliation(mapperFactory, classMap, summaryClassMap);
}
use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getGroupIdRecordMapperFacade.
public MapperFacade getGroupIdRecordMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<GroupIdRecord, GroupIdRecordEntity> classMap = mapperFactory.classMap(GroupIdRecord.class, GroupIdRecordEntity.class);
addV3CommonFields(classMap);
registerSourceConverters(mapperFactory, classMap);
classMap.field("name", "groupName");
classMap.field("groupId", "groupId");
classMap.field("description", "groupDescription");
classMap.field("type", "groupType");
classMap.register();
return mapperFactory.getMapperFacade();
}
Aggregations