From 35cdb61d395cc15223caeceb2f4585fb9e9439a3 Mon Sep 17 00:00:00 2001 From: SrdjanStevanetic Date: Tue, 17 Dec 2024 00:59:26 +0100 Subject: [PATCH] added zoho alternative acronym --- .../entitymanagement/service/DereferenceServiceIT.java | 3 +-- .../testutils/ZohoRecordTestDeserializer.java | 4 ++++ .../zoho-deref/organization_zoho_bnf_response.json | 4 +++- .../zoho/organization/ZohoOrganizationConverter.java | 8 +++++++- .../entitymanagement/zoho/utils/ZohoConstants.java | 2 ++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/service/DereferenceServiceIT.java b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/service/DereferenceServiceIT.java index 6c47b6b4..846e9a2f 100644 --- a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/service/DereferenceServiceIT.java +++ b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/service/DereferenceServiceIT.java @@ -77,9 +77,8 @@ public void zohoOrganizationDereferenceTest() throws Exception { Organization org = (Organization) orgOptional.get(); assertEquals(2, org.getPrefLabel().size()); assertNull(org.getAltLabel()); - assertEquals(1, org.getAcronym().size()); + assertEquals(2, org.getAcronym().size()); assertEquals(1, org.getEuropeanaRole().size()); - assertEquals(1, org.getAcronym().size()); Assertions.assertNotNull(org.getHomepage()); Assertions.assertNotNull(org.getLogo()); Assertions.assertNotNull(org.getAddress().getVcardStreetAddress()); diff --git a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/ZohoRecordTestDeserializer.java b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/ZohoRecordTestDeserializer.java index 5bd15218..6546a987 100644 --- a/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/ZohoRecordTestDeserializer.java +++ b/entity-management-tests/src/integration-test/java/eu/europeana/entitymanagement/testutils/ZohoRecordTestDeserializer.java @@ -1,6 +1,7 @@ package eu.europeana.entitymanagement.testutils; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.ACCOUNT_NAME_FIELD; +import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.ACRONYM_1_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.ACRONYM_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.AGGREGATING_FROM; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.AGGREGATORS; @@ -18,6 +19,7 @@ import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.ID_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.INDUSTRY_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.LANGUAGE_CODE_LENGTH; +import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.LANG_ACRONYM_1_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.LANG_ACRONYM_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.LANG_ALTERNATIVE_FIELD; import static eu.europeana.entitymanagement.zoho.utils.ZohoConstants.LANG_ORGANIZATION_NAME_FIELD; @@ -62,6 +64,8 @@ public class ZohoRecordTestDeserializer extends StdDeserializer { LANG_ORGANIZATION_NAME_FIELD, LANG_ACRONYM_FIELD, ACRONYM_FIELD, + LANG_ACRONYM_1_FIELD, + ACRONYM_1_FIELD, LOGO_LINK_TO_WIKIMEDIACOMMONS_FIELD, WEBSITE_FIELD, STREET_FIELD, diff --git a/entity-management-tests/src/integration-test/resources/zoho-deref/organization_zoho_bnf_response.json b/entity-management-tests/src/integration-test/resources/zoho-deref/organization_zoho_bnf_response.json index 1684fe08..cabdd358 100644 --- a/entity-management-tests/src/integration-test/resources/zoho-deref/organization_zoho_bnf_response.json +++ b/entity-management-tests/src/integration-test/resources/zoho-deref/organization_zoho_bnf_response.json @@ -24,5 +24,7 @@ "Logo" : "http://commons.wikimedia.org/wiki/Special:FilePath/Logo_BnF.svg", "Continent" : "Europe", "Tag" : [ ], - "Acronym" : "BnF" + "Acronym" : "BnF", + "Alternative_Acronym_1" : "FNL", + "Lang_Acronym_1" : "EN(English)" } diff --git a/entity-management-zoho/src/main/java/eu/europeana/entitymanagement/zoho/organization/ZohoOrganizationConverter.java b/entity-management-zoho/src/main/java/eu/europeana/entitymanagement/zoho/organization/ZohoOrganizationConverter.java index 844c2213..bbf4bb82 100644 --- a/entity-management-zoho/src/main/java/eu/europeana/entitymanagement/zoho/organization/ZohoOrganizationConverter.java +++ b/entity-management-zoho/src/main/java/eu/europeana/entitymanagement/zoho/organization/ZohoOrganizationConverter.java @@ -47,7 +47,13 @@ public static void fillOrganizationInfoFromZohoRecord(Organization org, Record z String acronym = getStringFieldValue(zohoRecord, ZohoConstants.ACRONYM_FIELD); String langAcronym = getStringFieldValue(zohoRecord, ZohoConstants.LANG_ACRONYM_FIELD); - org.setAcronym(ZohoUtils.createLanguageMapOfStringList(langAcronym, acronym)); + String acronym_1 = getStringFieldValue(zohoRecord, ZohoConstants.ACRONYM_1_FIELD); + String langAcronym_1 = getStringFieldValue(zohoRecord, ZohoConstants.LANG_ACRONYM_1_FIELD); + Map> acronymMap = ZohoUtils.createLanguageMapOfStringList(langAcronym, acronym); + Map> acronym_1_Map = ZohoUtils.createLanguageMapOfStringList(langAcronym_1, acronym_1); + Map> acronymFinalMap = ZohoUtils.mergeMapsWithLists(acronymMap, acronym_1_Map); + org.setAcronym(acronymFinalMap); + String logoFieldName = ZohoConstants.LOGO_LINK_TO_WIKIMEDIACOMMONS_FIELD; org.setLogo(buildWebResource(zohoRecord, logoFieldName)); org.setHomepage(getStringFieldValue(zohoRecord, ZohoConstants.WEBSITE_FIELD)); diff --git a/entity-management-zoho/src/main/java/eu/europeana/entitymanagement/zoho/utils/ZohoConstants.java b/entity-management-zoho/src/main/java/eu/europeana/entitymanagement/zoho/utils/ZohoConstants.java index 67b263e3..014bd643 100644 --- a/entity-management-zoho/src/main/java/eu/europeana/entitymanagement/zoho/utils/ZohoConstants.java +++ b/entity-management-zoho/src/main/java/eu/europeana/entitymanagement/zoho/utils/ZohoConstants.java @@ -32,6 +32,8 @@ public final class ZohoConstants { public static final String ALTERNATIVE_FIELD = "Alternative"; public static final String LANG_ACRONYM_FIELD = "Lang_Acronym"; public static final String ACRONYM_FIELD = "Acronym"; + public static final String LANG_ACRONYM_1_FIELD = "Lang_Acronym_1"; + public static final String ACRONYM_1_FIELD = "Alternative_Acronym_1"; // public static final String LOGO_LINK_TO_WIKIMEDIACOMMONS_FIELD = "Logo_link_to_WikimediaCommons"; public static final String LOGO_LINK_TO_WIKIMEDIACOMMONS_FIELD = "Logo"; public static final String WEBSITE_FIELD = "Website";