use of ma.glasnost.orika.MapperFactory 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();
}
use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getPeerReviewMapperFacade.
public MapperFacade getPeerReviewMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ConverterFactory converterFactory = mapperFactory.getConverterFactory();
converterFactory.registerConverter("workExternalIdentifiersConverterId", new JSONWorkExternalIdentifiersConverterV3(norm, localeManager));
converterFactory.registerConverter("workExternalIdentifierConverterId", new JSONPeerReviewWorkExternalIdentifierConverterV3());
// do same as work
ClassMapBuilder<PeerReview, PeerReviewEntity> classMap = mapperFactory.classMap(PeerReview.class, PeerReviewEntity.class);
addV3CommonFields(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);
addV3CommonFields(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 getExternalIdentifierMapperFacade.
public MapperFacade getExternalIdentifierMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<PersonExternalIdentifier, ExternalIdentifierEntity> externalIdentifierClassMap = mapperFactory.classMap(PersonExternalIdentifier.class, ExternalIdentifierEntity.class);
addV3DateFields(externalIdentifierClassMap);
externalIdentifierClassMap.field("putCode", "id");
externalIdentifierClassMap.field("type", "externalIdCommonName");
externalIdentifierClassMap.field("value", "externalIdReference");
externalIdentifierClassMap.field("url.value", "externalIdUrl");
externalIdentifierClassMap.fieldBToA("displayIndex", "displayIndex");
externalIdentifierClassMap.byDefault();
registerSourceConverters(mapperFactory, externalIdentifierClassMap);
// TODO: add relationship to database schema for people.
externalIdentifierClassMap.register();
return mapperFactory.getMapperFacade();
}
use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getEducationMapperFacade.
public MapperFacade getEducationMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<Education, OrgAffiliationRelationEntity> classMap = mapperFactory.classMap(Education.class, OrgAffiliationRelationEntity.class);
ClassMapBuilder<EducationSummary, OrgAffiliationRelationEntity> summaryClassMap = mapperFactory.classMap(EducationSummary.class, OrgAffiliationRelationEntity.class);
return generateMapperFacadeForAffiliation(mapperFactory, classMap, summaryClassMap);
}
use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.
the class MapperFacadeFactory method getAddressMapperFacade.
public MapperFacade getAddressMapperFacade() {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
ClassMapBuilder<Address, AddressEntity> addressClassMap = mapperFactory.classMap(Address.class, AddressEntity.class);
addV3DateFields(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();
}
Aggregations