Fixing code

This commit is contained in:
Luca Frosini 2024-03-27 16:30:53 +01:00
parent 5292cc6967
commit 67f7aed1c2
4 changed files with 5 additions and 6 deletions

View File

@ -91,8 +91,6 @@ public abstract class Record extends CKANPackage {
protected Set<FileContainer> 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);

View File

@ -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;

View File

@ -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);

View File

@ -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);