public MapperFacade getKeywordMapperFacade() {
   MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
   ClassMapBuilder<Keyword, ProfileKeywordEntity> keywordClassMap =
       mapperFactory.classMap(Keyword.class, ProfileKeywordEntity.class);
   addV2DateFields(keywordClassMap);
   registerSourceConverters(mapperFactory, keywordClassMap);
   keywordClassMap.field("putCode", "id");
   keywordClassMap.field("content", "keywordName");
   keywordClassMap.fieldBToA("displayIndex", "displayIndex");
   keywordClassMap.byDefault();
   keywordClassMap.register();
   return mapperFactory.getMapperFacade();
 }
 public MapperFacade getAddressMapperFacade() {
   MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
   ClassMapBuilder<Address, AddressEntity> addressClassMap =
       mapperFactory.classMap(Address.class, AddressEntity.class);
   addV2DateFields(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();
 }
 public MapperFacade getOtherNameMapperFacade() {
   MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
   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();
 }
 public MapperFacade getResearcherUrlMapperFacade() {
   MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
   ClassMapBuilder<ResearcherUrl, ResearcherUrlEntity> researcherUrlClassMap =
       mapperFactory.classMap(ResearcherUrl.class, ResearcherUrlEntity.class);
   addV2DateFields(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();
 }
  public MapperFacade getExternalIdentifierMapperFacade() {
    MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
    ClassMapBuilder<PersonExternalIdentifier, ExternalIdentifierEntity> externalIdentifierClassMap =
        mapperFactory.classMap(PersonExternalIdentifier.class, ExternalIdentifierEntity.class);
    addV2DateFields(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();
  }
  public MapperFacade getFundingMapperFacade() {
    MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
    ConverterFactory converterFactory = mapperFactory.getConverterFactory();
    converterFactory.registerConverter(
        "fundingExternalIdentifiersConverterId", new FundingExternalIDsConverter());
    converterFactory.registerConverter(
        "fundingContributorsConverterId", new JsonOrikaConverter<FundingContributors>());

    ClassMapBuilder<Funding, ProfileFundingEntity> fundingClassMap =
        mapperFactory.classMap(Funding.class, ProfileFundingEntity.class);
    addV2CommonFields(fundingClassMap);
    registerSourceConverters(mapperFactory, fundingClassMap);
    fundingClassMap.field("type", "type");
    fundingClassMap.field("organizationDefinedType.content", "organizationDefinedType");
    fundingClassMap.field("title.title.content", "title");
    fundingClassMap.field("title.translatedTitle.content", "translatedTitle");
    fundingClassMap.field("title.translatedTitle.languageCode", "translatedTitleLanguageCode");
    fundingClassMap.field("description", "description");
    fundingClassMap.field("amount.content", "numericAmount");
    fundingClassMap.field("amount.currencyCode", "currencyCode");
    fundingClassMap.field("url.value", "url");
    fundingClassMap.fieldBToA("org.name", "organization.name");
    fundingClassMap.fieldBToA("org.city", "organization.address.city");
    fundingClassMap.fieldBToA("org.region", "organization.address.region");
    fundingClassMap.fieldBToA("org.country", "organization.address.country");
    fundingClassMap.fieldBToA(
        "org.orgDisambiguated.sourceId",
        "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
    fundingClassMap.fieldBToA(
        "org.orgDisambiguated.sourceType",
        "organization.disambiguatedOrganization.disambiguationSource");
    fundingClassMap
        .fieldMap("externalIdentifiers", "externalIdentifiersJson")
        .converter("fundingExternalIdentifiersConverterId")
        .add();
    fundingClassMap
        .fieldMap("contributors", "contributorsJson")
        .converter("fundingContributorsConverterId")
        .add();
    fundingClassMap.register();

    ClassMapBuilder<FundingSummary, ProfileFundingEntity> fundingSummaryClassMap =
        mapperFactory.classMap(FundingSummary.class, ProfileFundingEntity.class);
    addV2CommonFields(fundingSummaryClassMap);
    registerSourceConverters(mapperFactory, fundingSummaryClassMap);
    fundingSummaryClassMap.field("type", "type");
    fundingSummaryClassMap.field("title.title.content", "title");
    fundingSummaryClassMap.field("title.translatedTitle.content", "translatedTitle");
    fundingSummaryClassMap.field(
        "title.translatedTitle.languageCode", "translatedTitleLanguageCode");
    fundingSummaryClassMap
        .fieldMap("externalIdentifiers", "externalIdentifiersJson")
        .converter("fundingExternalIdentifiersConverterId")
        .add();

    fundingSummaryClassMap.fieldBToA("org.name", "organization.name");
    fundingSummaryClassMap.fieldBToA("org.city", "organization.address.city");
    fundingSummaryClassMap.fieldBToA("org.region", "organization.address.region");
    fundingSummaryClassMap.fieldBToA("org.country", "organization.address.country");
    fundingSummaryClassMap.fieldBToA(
        "org.orgDisambiguated.sourceId",
        "organization.disambiguatedOrganization.disambiguatedOrganizationIdentifier");
    fundingSummaryClassMap.fieldBToA(
        "org.orgDisambiguated.sourceType",
        "organization.disambiguatedOrganization.disambiguationSource");

    fundingSummaryClassMap.register();

    mapperFactory
        .classMap(FuzzyDate.class, StartDateEntity.class)
        .field("year.value", "year")
        .field("month.value", "month")
        .field("day.value", "day")
        .register();
    mapperFactory
        .classMap(FuzzyDate.class, EndDateEntity.class)
        .field("year.value", "year")
        .field("month.value", "month")
        .field("day.value", "day")
        .register();
    return mapperFactory.getMapperFacade();
  }