Search in sources :

Example 1 with JSONPeerReviewWorkExternalIdentifierConverterV2

use of org.orcid.core.adapter.jsonidentifier.converter.JSONPeerReviewWorkExternalIdentifierConverterV2 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();
}
Also used : JSONWorkExternalIdentifiersConverterV2(org.orcid.core.adapter.jsonidentifier.converter.JSONWorkExternalIdentifiersConverterV2) PeerReviewSummary(org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary) PeerReviewEntity(org.orcid.persistence.jpa.entities.PeerReviewEntity) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) MapperFactory(ma.glasnost.orika.MapperFactory) ConverterFactory(ma.glasnost.orika.converter.ConverterFactory) JSONPeerReviewWorkExternalIdentifierConverterV2(org.orcid.core.adapter.jsonidentifier.converter.JSONPeerReviewWorkExternalIdentifierConverterV2) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview)

Aggregations

MapperFactory (ma.glasnost.orika.MapperFactory)1 ConverterFactory (ma.glasnost.orika.converter.ConverterFactory)1 DefaultMapperFactory (ma.glasnost.orika.impl.DefaultMapperFactory)1 JSONPeerReviewWorkExternalIdentifierConverterV2 (org.orcid.core.adapter.jsonidentifier.converter.JSONPeerReviewWorkExternalIdentifierConverterV2)1 JSONWorkExternalIdentifiersConverterV2 (org.orcid.core.adapter.jsonidentifier.converter.JSONWorkExternalIdentifiersConverterV2)1 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)1 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)1 PeerReviewEntity (org.orcid.persistence.jpa.entities.PeerReviewEntity)1