From 93d7e64bb657b2b78b81e1665e5443ec74ad915d Mon Sep 17 00:00:00 2001 From: GordeaS Date: Tue, 23 Apr 2024 12:45:10 +0200 Subject: [PATCH] fix indexing of country iso code #EA-3721 --- .../common/config/EntityManagementConfiguration.java | 6 ++++-- .../entitymanagement/solr/model/SolrOrganization.java | 6 +++--- .../entitymanagement/web/service/EntityRecordService.java | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/entity-management-common/src/main/java/eu/europeana/entitymanagement/common/config/EntityManagementConfiguration.java b/entity-management-common/src/main/java/eu/europeana/entitymanagement/common/config/EntityManagementConfiguration.java index a420aeba..ae387bcc 100644 --- a/entity-management-common/src/main/java/eu/europeana/entitymanagement/common/config/EntityManagementConfiguration.java +++ b/entity-management-common/src/main/java/eu/europeana/entitymanagement/common/config/EntityManagementConfiguration.java @@ -257,8 +257,10 @@ void addToCountryMappings(List countryMappingList) { void addToCountryIdMappings(List countryMappingList) { for (ZohoLabelUriMapping countryMapping : countryMappingList) { - //init entityID - to ZohoCountry mapping - countryIdMappings.put(countryMapping.getZohoLabel(), countryMapping); + //init entityID - to ZohoCountry mapping + if(countryMapping.getEntityUri() != null) { + countryIdMappings.put(countryMapping.getEntityUri(), countryMapping); + } } } diff --git a/entity-management-solr/src/main/java/eu/europeana/entitymanagement/solr/model/SolrOrganization.java b/entity-management-solr/src/main/java/eu/europeana/entitymanagement/solr/model/SolrOrganization.java index 13c83812..ad07a050 100644 --- a/entity-management-solr/src/main/java/eu/europeana/entitymanagement/solr/model/SolrOrganization.java +++ b/entity-management-solr/src/main/java/eu/europeana/entitymanagement/solr/model/SolrOrganization.java @@ -92,12 +92,12 @@ public SolrOrganization(Organization organization) { this.country=new ArrayList<>(); String orgCountryId=organization.getCountryId(); - String orgCoutryISO=organization.getCountryISO(); + String orgCountryISO=organization.getCountryISO(); if(orgCountryId!=null) { this.country.add(orgCountryId); } - if(orgCoutryISO!=null) { - this.country.add(orgCoutryISO); + if(orgCountryISO!=null) { + this.country.add(orgCountryISO); } if(organization.getCountry() != null) { this.setCountryLabel(organization.getCountry().getPrefLabel()); diff --git a/entity-management-web/src/main/java/eu/europeana/entitymanagement/web/service/EntityRecordService.java b/entity-management-web/src/main/java/eu/europeana/entitymanagement/web/service/EntityRecordService.java index 46f4ca09..bf1b27ba 100644 --- a/entity-management-web/src/main/java/eu/europeana/entitymanagement/web/service/EntityRecordService.java +++ b/entity-management-web/src/main/java/eu/europeana/entitymanagement/web/service/EntityRecordService.java @@ -184,7 +184,7 @@ public void dereferenceLinkedEntities(Organization org) { new String[] {EntityRecordFields.ENTITY}); setDereferencedCountry(org, countryRecord); - ZohoLabelUriMapping mapping = emConfiguration.getCountryIdMappings().get(org.getEntityId()); + ZohoLabelUriMapping mapping = emConfiguration.getCountryIdMappings().get(org.getCountryId()); if(mapping != null) { //extract ISO code from ZohoCountry org.setCountryISO(mapping.getCountryISOCode());