Search in sources :

Example 21 with MapperFactory

use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.

the class MapperFacadeFactory method getEducationMapperFacade.

public MapperFacade getEducationMapperFacade() {
    MapperFactory mapperFactory = getNewMapperFactory();
    ClassMapBuilder<Education, OrgAffiliationRelationEntity> educationClassMap = mapperFactory.classMap(Education.class, OrgAffiliationRelationEntity.class);
    addV2CommonFields(educationClassMap);
    registerSourceConverters(mapperFactory, educationClassMap);
    educationClassMap.fieldBToA("org.name", "organization.name");
    educationClassMap.fieldBToA("org.city", "organization.address.city");
    educationClassMap.fieldBToA("org.region", "organization.address.region");
    educationClassMap.fieldBToA("org.country", "organization.address.country");
    educationClassMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
    educationClassMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
    educationClassMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
    educationClassMap.field("departmentName", "department");
    educationClassMap.field("roleTitle", "title");
    educationClassMap.register();
    ClassMapBuilder<EducationSummary, OrgAffiliationRelationEntity> educationSummaryClassMap = mapperFactory.classMap(EducationSummary.class, OrgAffiliationRelationEntity.class);
    addV2CommonFields(educationSummaryClassMap);
    registerSourceConverters(mapperFactory, educationSummaryClassMap);
    educationSummaryClassMap.fieldBToA("org.name", "organization.name");
    educationSummaryClassMap.fieldBToA("org.city", "organization.address.city");
    educationSummaryClassMap.fieldBToA("org.region", "organization.address.region");
    educationSummaryClassMap.fieldBToA("org.country", "organization.address.country");
    educationSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
    educationSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
    educationSummaryClassMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
    educationSummaryClassMap.field("departmentName", "department");
    educationSummaryClassMap.field("roleTitle", "title");
    educationSummaryClassMap.register();
    mapFuzzyDateToStartDateEntityAndEndDateEntity(mapperFactory);
    return mapperFactory.getMapperFacade();
}
Also used : Education(org.orcid.jaxb.model.record_v2.Education) EducationSummary(org.orcid.jaxb.model.record.summary_v2.EducationSummary) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) MapperFactory(ma.glasnost.orika.MapperFactory) OrgAffiliationRelationEntity(org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity)

Example 22 with MapperFactory

use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.

the class MapperFacadeFactory method getEmailMapperFacade.

public MapperFacade getEmailMapperFacade() {
    MapperFactory mapperFactory = getNewMapperFactory();
    ClassMapBuilder<Email, EmailEntity> emailClassMap = mapperFactory.classMap(Email.class, EmailEntity.class);
    emailClassMap.byDefault();
    emailClassMap.field("email", "id");
    emailClassMap.field("primary", "primary");
    emailClassMap.field("verified", "verified");
    addV2DateFields(emailClassMap);
    registerSourceConverters(mapperFactory, emailClassMap);
    emailClassMap.register();
    return mapperFactory.getMapperFacade();
}
Also used : Email(org.orcid.jaxb.model.record_v2.Email) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) MapperFactory(ma.glasnost.orika.MapperFactory) EmailEntity(org.orcid.persistence.jpa.entities.EmailEntity)

Example 23 with MapperFactory

use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.

the class MapperFacadeFactory method getOtherNameMapperFacade.

public MapperFacade getOtherNameMapperFacade() {
    MapperFactory mapperFactory = getNewMapperFactory();
    ClassMapBuilder<OtherName, OtherNameEntity> otherNameClassMap = mapperFactory.classMap(OtherName.class, OtherNameEntity.class);
    addV2DateFields(otherNameClassMap);
    registerSourceConverters(mapperFactory, otherNameClassMap);
    otherNameClassMap.field("putCode", "id");
    otherNameClassMap.field("content", "displayName");
    otherNameClassMap.field("path", "profile.orcid");
    otherNameClassMap.fieldBToA("displayIndex", "displayIndex");
    otherNameClassMap.byDefault();
    otherNameClassMap.register();
    return mapperFactory.getMapperFacade();
}
Also used : DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) MapperFactory(ma.glasnost.orika.MapperFactory) OtherName(org.orcid.jaxb.model.record_v2.OtherName) OtherNameEntity(org.orcid.persistence.jpa.entities.OtherNameEntity)

Example 24 with MapperFactory

use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.

the class MapperFacadeFactory method getEmploymentMapperFacade.

public MapperFacade getEmploymentMapperFacade() {
    MapperFactory mapperFactory = getNewMapperFactory();
    ClassMapBuilder<Employment, OrgAffiliationRelationEntity> classMap = mapperFactory.classMap(Employment.class, OrgAffiliationRelationEntity.class);
    addV2CommonFields(classMap);
    registerSourceConverters(mapperFactory, classMap);
    classMap.fieldBToA("org.name", "organization.name");
    classMap.fieldBToA("org.city", "organization.address.city");
    classMap.fieldBToA("org.region", "organization.address.region");
    classMap.fieldBToA("org.country", "organization.address.country");
    classMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
    classMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
    classMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
    classMap.field("departmentName", "department");
    classMap.field("roleTitle", "title");
    classMap.register();
    ClassMapBuilder<EmploymentSummary, OrgAffiliationRelationEntity> employmentSummaryClassMap = mapperFactory.classMap(EmploymentSummary.class, OrgAffiliationRelationEntity.class);
    addV2CommonFields(employmentSummaryClassMap);
    registerSourceConverters(mapperFactory, employmentSummaryClassMap);
    employmentSummaryClassMap.fieldBToA("org.name", "organization.name");
    employmentSummaryClassMap.fieldBToA("org.city", "organization.address.city");
    employmentSummaryClassMap.fieldBToA("org.region", "organization.address.region");
    employmentSummaryClassMap.fieldBToA("org.country", "organization.address.country");
    employmentSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceId", "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
    employmentSummaryClassMap.fieldBToA("org.orgDisambiguated.sourceType", "organization.disambiguatedOrganization.disambiguationSource");
    employmentSummaryClassMap.fieldBToA("org.orgDisambiguated.id", "organization.disambiguatedOrganization.id");
    employmentSummaryClassMap.field("departmentName", "department");
    employmentSummaryClassMap.field("roleTitle", "title");
    employmentSummaryClassMap.register();
    mapFuzzyDateToStartDateEntityAndEndDateEntity(mapperFactory);
    return mapperFactory.getMapperFacade();
}
Also used : Employment(org.orcid.jaxb.model.record_v2.Employment) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) MapperFactory(ma.glasnost.orika.MapperFactory) EmploymentSummary(org.orcid.jaxb.model.record.summary_v2.EmploymentSummary) OrgAffiliationRelationEntity(org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity)

Example 25 with MapperFactory

use of ma.glasnost.orika.MapperFactory in project ORCID-Source by ORCID.

the class MapperFacadeFactory method getNameMapperFacade.

public MapperFacade getNameMapperFacade() {
    MapperFactory mapperFactory = getNewMapperFactory();
    ClassMapBuilder<Name, RecordNameEntity> nameClassMap = mapperFactory.classMap(Name.class, RecordNameEntity.class);
    addV2DateFields(nameClassMap);
    nameClassMap.field("creditName.content", "creditName");
    nameClassMap.field("givenNames.content", "givenNames");
    nameClassMap.field("familyName.content", "familyName");
    nameClassMap.field("path", "profile.id");
    nameClassMap.byDefault();
    nameClassMap.register();
    return mapperFactory.getMapperFacade();
}
Also used : DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) MapperFactory(ma.glasnost.orika.MapperFactory) RecordNameEntity(org.orcid.persistence.jpa.entities.RecordNameEntity) SourceName(org.orcid.jaxb.model.common_v2.SourceName) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name)

Aggregations

MapperFactory (ma.glasnost.orika.MapperFactory)42 DefaultMapperFactory (ma.glasnost.orika.impl.DefaultMapperFactory)42 ConverterFactory (ma.glasnost.orika.converter.ConverterFactory)9 OrgAffiliationRelationEntity (org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity)9 MappingContext (ma.glasnost.orika.MappingContext)4 NotificationWorkEntity (org.orcid.persistence.jpa.entities.NotificationWorkEntity)3 Date (java.util.Date)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 TreeSet (java.util.TreeSet)2 MapperFacade (ma.glasnost.orika.MapperFacade)2 ExternalIdentifierTypeConverter (org.orcid.core.adapter.jsonidentifier.converter.ExternalIdentifierTypeConverter)2 JSONWorkExternalIdentifiersConverterV2 (org.orcid.core.adapter.jsonidentifier.converter.JSONWorkExternalIdentifiersConverterV2)2 JSONWorkExternalIdentifiersConverterV3 (org.orcid.core.adapter.jsonidentifier.converter.JSONWorkExternalIdentifiersConverterV3)2 OtherName (org.orcid.jaxb.model.record_v2.OtherName)2 RecordCorrection (org.orcid.model.record_correction.RecordCorrection)2 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)2 ClientRedirectUriEntity (org.orcid.persistence.jpa.entities.ClientRedirectUriEntity)2 ClientSecretEntity (org.orcid.persistence.jpa.entities.ClientSecretEntity)2