From 6c7b06251840ff08cfb8fa3216be6be9d8ffbe91 Mon Sep 17 00:00:00 2001 From: SrdjanStevanetic Date: Sun, 15 Dec 2024 00:18:22 +0100 Subject: [PATCH] improve sonar cloud reliability issues --- .../definitions/model/Aggregator.java | 7 ------- .../solr/model/SolrOrganization.java | 21 +++++++++++++++++-- .../ZohoOrganizationConverter.java | 5 ++--- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/entity-management-definitions/src/main/java/eu/europeana/entitymanagement/definitions/model/Aggregator.java b/entity-management-definitions/src/main/java/eu/europeana/entitymanagement/definitions/model/Aggregator.java index 6869f9d9..dbbe7bef 100644 --- a/entity-management-definitions/src/main/java/eu/europeana/entitymanagement/definitions/model/Aggregator.java +++ b/entity-management-definitions/src/main/java/eu/europeana/entitymanagement/definitions/model/Aggregator.java @@ -28,7 +28,6 @@ import static eu.europeana.entitymanagement.vocabulary.WebEntityFields.PROVIDES_SUPPORT_FOR_MEDIA_TYPE; import static eu.europeana.entitymanagement.vocabulary.WebEntityFields.SAME_AS; import static eu.europeana.entitymanagement.vocabulary.WebEntityFields.TYPE; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.annotation.JsonGetter; @@ -109,12 +108,6 @@ public String getType() { return type; } - @Override - public Object getFieldValue(Field field) throws IllegalAccessException { - // method to call the getters for each field individually - return field.get(this); - } - @JsonGetter(FOAF_MBOX) public String getMbox() { return mbox; 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 79828611..12139822 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 @@ -1,5 +1,24 @@ package eu.europeana.entitymanagement.solr.model; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.COUNTRY; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.COUNTRY_LABEL; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.COUNTRY_LABEL_ALL; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.DC_DESCRIPTION; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.DC_DESCRIPTION_ALL; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.EDM_ACRONYM; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.EDM_ACRONYM_ALL; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.EUROPEANA_ROLE; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.FOAF_HOMEPAGE; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.FOAF_LOGO; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.FOAF_PHONE; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.VCARD_COUNTRYNAME; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.VCARD_HAS_ADDRESS; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.VCARD_HAS_GEO; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.VCARD_LOCALITY; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.VCARD_POSTAL_CODE; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.VCARD_POST_OFFICE_BOX; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.VCARD_REGION; +import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.VCARD_STREET_ADDRESS; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -11,7 +30,6 @@ import eu.europeana.entitymanagement.solr.SolrUtils; import eu.europeana.entitymanagement.utils.EntityUtils; import eu.europeana.entitymanagement.vocabulary.EntitySolrFields; -import static eu.europeana.entitymanagement.vocabulary.OrganizationSolrFields.*; public class SolrOrganization extends SolrEntity { @@ -70,7 +88,6 @@ public class SolrOrganization extends SolrEntity { private String hasGeo; public SolrOrganization() { - super(); } public SolrOrganization(Organization organization) { 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 a7f3f814..844c2213 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 @@ -281,9 +281,8 @@ public static String getOwnerName(Record recordOrganization) { public static Record getSubRecord(Record record, String fieldName) { Object keyValue = record.getKeyValue(fieldName); - if(keyValue!=null && keyValue instanceof Record) { - Record subRec = (Record) keyValue; - return subRec; + if(keyValue instanceof Record) { + return (Record)keyValue; } return null; }