From 67f7aed1c22051300451acf53e837a1e01e62096 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 27 Mar 2024 16:30:53 +0100 Subject: [PATCH] Fixing code --- .../java/org/gcube/grsf/publisher/ckan/record/Record.java | 4 +--- .../publisher/configuration/GRSFCatalogueConfiguration.java | 1 - .../isproxies/impl/GRSFFacetBasedISConfigurationProxy.java | 3 ++- .../isproxies/impl/GRSFGCoreISConfigurationProxy.java | 3 ++- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/gcube/grsf/publisher/ckan/record/Record.java b/src/main/java/org/gcube/grsf/publisher/ckan/record/Record.java index 0f3618d..24348ed 100644 --- a/src/main/java/org/gcube/grsf/publisher/ckan/record/Record.java +++ b/src/main/java/org/gcube/grsf/publisher/ckan/record/Record.java @@ -91,8 +91,6 @@ public abstract class Record extends CKANPackage { protected Set wsUploadedFiles; - protected GRSFCatalogueConfiguration configuration; - public Record() { super(GRSFCatalogueConfigurationFactory.getInstance()); this.objectMapper = new ObjectMapper(); @@ -254,7 +252,7 @@ public abstract class Record extends CKANPackage { String recordURL = uriResolver.getCatalogueItemURL(grsfUUID); map.put(RECORD_URL_TEMPLATE_PROPERTY_KEY, recordURL); - map.put(INCLUDE_SENSITIVE_TEMPLATE_PROPERTY_KEY, configuration.isIncludeSensitive()); + map.put(INCLUDE_SENSITIVE_TEMPLATE_PROPERTY_KEY, ((GRSFCatalogueConfiguration) configuration).isIncludeSensitive()); map.put(IS_PATCH_TEMPLATE_PROPERTY_KEY, patch); diff --git a/src/main/java/org/gcube/grsf/publisher/configuration/GRSFCatalogueConfiguration.java b/src/main/java/org/gcube/grsf/publisher/configuration/GRSFCatalogueConfiguration.java index f94a92d..19b744d 100644 --- a/src/main/java/org/gcube/grsf/publisher/configuration/GRSFCatalogueConfiguration.java +++ b/src/main/java/org/gcube/grsf/publisher/configuration/GRSFCatalogueConfiguration.java @@ -3,7 +3,6 @@ package org.gcube.grsf.publisher.configuration; import java.util.Map; import java.util.Set; -import org.gcube.com.fasterxml.jackson.databind.ObjectMapper; import org.gcube.gcat.configuration.service.ServiceCatalogueConfiguration; import org.gcube.grsf.publisher.utils.OrganizationUtils; diff --git a/src/main/java/org/gcube/grsf/publisher/configuration/isproxies/impl/GRSFFacetBasedISConfigurationProxy.java b/src/main/java/org/gcube/grsf/publisher/configuration/isproxies/impl/GRSFFacetBasedISConfigurationProxy.java index 0d30496..ffbe2a3 100644 --- a/src/main/java/org/gcube/grsf/publisher/configuration/isproxies/impl/GRSFFacetBasedISConfigurationProxy.java +++ b/src/main/java/org/gcube/grsf/publisher/configuration/isproxies/impl/GRSFFacetBasedISConfigurationProxy.java @@ -60,7 +60,8 @@ public class GRSFFacetBasedISConfigurationProxy extends FacetBasedISConfiguratio try { ServiceCatalogueConfiguration scc = super.readFromIS(); ObjectMapper objectMapper = new ObjectMapper(); - GRSFCatalogueConfiguration grsfCC = objectMapper.treeToValue(objectMapper.valueToTree(scc), GRSFCatalogueConfiguration.class); + String json = objectMapper.writeValueAsString(scc); + GRSFCatalogueConfiguration grsfCC = objectMapper.readValue(json, GRSFCatalogueConfiguration.class); return grsfCC; }catch (Exception e) { throw new RuntimeException(e); diff --git a/src/main/java/org/gcube/grsf/publisher/configuration/isproxies/impl/GRSFGCoreISConfigurationProxy.java b/src/main/java/org/gcube/grsf/publisher/configuration/isproxies/impl/GRSFGCoreISConfigurationProxy.java index 4222b44..5628254 100644 --- a/src/main/java/org/gcube/grsf/publisher/configuration/isproxies/impl/GRSFGCoreISConfigurationProxy.java +++ b/src/main/java/org/gcube/grsf/publisher/configuration/isproxies/impl/GRSFGCoreISConfigurationProxy.java @@ -19,7 +19,8 @@ public class GRSFGCoreISConfigurationProxy extends GCoreISConfigurationProxy { try { ServiceCatalogueConfiguration scc = super.readFromIS(); ObjectMapper objectMapper = new ObjectMapper(); - GRSFCatalogueConfiguration grsfCC = objectMapper.treeToValue(objectMapper.valueToTree(scc), GRSFCatalogueConfiguration.class); + String json = objectMapper.writeValueAsString(scc); + GRSFCatalogueConfiguration grsfCC = objectMapper.readValue(json, GRSFCatalogueConfiguration.class); return grsfCC; }catch (Exception e) { throw new RuntimeException(e);