diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java index 78d03d4..9e65058 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java @@ -70,6 +70,9 @@ public abstract class HelperMethods { public static final String PREVALIDATE_CONTEX_KEY = "PreValidateVRE"; public static final String PUBLIC_CONTEX_KEY = "PublicVRE"; private static final String PATH_SEPARATOR = "/"; + + // This key is used in replaceFieldsKey() function to indicate to remove the metadata field + private static final String NONE_KEY = "none"; // caches private static CacheInterface userEmailCache = new CacheImpl(1000 * 60 * 60 * 24); @@ -571,16 +574,18 @@ public abstract class HelperMethods { if(namespaces.containsKey(entry.getKey())){ usedKey = namespaces.get(entry.getKey()); - } - else{ + } else{ usedKey = entry.getKey(); } - if(isSourceRecord) + if(isSourceRecord) { usedKey = usedKey.replace("GRSF", "").trim(); + } - toReturn.put(usedKey, entry.getValue()); - + // When the replaced key is none the metadata field must be removed + if(usedKey.compareTo(NONE_KEY)!=0) { + toReturn.put(usedKey, entry.getValue()); + } } return toReturn;