Search in sources :

Example 26 with OtherNameEntity

use of org.orcid.persistence.jpa.entities.OtherNameEntity 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 27 with OtherNameEntity

use of org.orcid.persistence.jpa.entities.OtherNameEntity in project ORCID-Source by ORCID.

the class MapperFacadeFactory method getOtherNameMapperFacade.

public MapperFacade getOtherNameMapperFacade() {
    MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
    ClassMapBuilder<OtherName, OtherNameEntity> otherNameClassMap = mapperFactory.classMap(OtherName.class, OtherNameEntity.class);
    addV3DateFields(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) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) MapperFactory(ma.glasnost.orika.MapperFactory) OtherName(org.orcid.jaxb.model.v3.dev1.record.OtherName) OtherNameEntity(org.orcid.persistence.jpa.entities.OtherNameEntity)

Aggregations

OtherNameEntity (org.orcid.persistence.jpa.entities.OtherNameEntity)27 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)13 Date (java.util.Date)12 Transactional (org.springframework.transaction.annotation.Transactional)11 Test (org.junit.Test)10 ExternalIdentifierEntity (org.orcid.persistence.jpa.entities.ExternalIdentifierEntity)7 ProfileKeywordEntity (org.orcid.persistence.jpa.entities.ProfileKeywordEntity)7 ResearcherUrlEntity (org.orcid.persistence.jpa.entities.ResearcherUrlEntity)7 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)7 OrcidDuplicatedElementException (org.orcid.core.exception.OrcidDuplicatedElementException)6 AddressEntity (org.orcid.persistence.jpa.entities.AddressEntity)6 DBUnitTest (org.orcid.test.DBUnitTest)6 HashMap (java.util.HashMap)4 OtherName (org.orcid.jaxb.model.record_v2.OtherName)4 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)4 ApplicationException (org.orcid.core.exception.ApplicationException)3 OrgAffiliationRelationEntity (org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity)3 ProfileFundingEntity (org.orcid.persistence.jpa.entities.ProfileFundingEntity)3 InvalidParameterException (java.security.InvalidParameterException)2 MapperFactory (ma.glasnost.orika.MapperFactory)2