diff --git a/CHANGELOG.md b/CHANGELOG.md index a32ef9e..3d677d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Aligned APIs to other clients [#22011] - Moved Direction class in information-system-model +- Added support for context names included in header among UUIDs [#22090] ## [v4.1.0] diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClient.java b/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClient.java index c4ee601..85abfaf 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClient.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClient.java @@ -2,7 +2,6 @@ package org.gcube.informationsystem.resourceregistry.client; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.UUID; import org.gcube.informationsystem.base.reference.Direction; @@ -97,10 +96,10 @@ public interface ResourceRegistryClient { public List getAllContext() throws ResourceRegistryException; - public Set getInstanceContexts(Class clazz, UUID uuid) + public Map getInstanceContexts(Class clazz, UUID uuid) throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException; - public Set getInstanceContexts(String type, UUID uuid) + public Map getInstanceContexts(String type, UUID uuid) throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException; } diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientImpl.java index f74ff51..b017fb5 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientImpl.java @@ -5,7 +5,6 @@ import java.net.HttpURLConnection; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.UUID; import org.gcube.common.gxhttp.reference.GXConnection; @@ -609,14 +608,14 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient { } @Override - public Set getInstanceContexts(Class clazz, UUID uuid) + public Map getInstanceContexts(Class clazz, UUID uuid) throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException { String typeName = Utility.getTypeName(clazz); return getInstanceContexts(typeName, uuid); } @Override - public Set getInstanceContexts(String type, UUID uuid) + public Map getInstanceContexts(String type, UUID uuid) throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException { try { logger.trace("Going to get contexts of {} with UUID {}", type, uuid); @@ -630,11 +629,11 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient { gxHTTPStringRequest.path(AccessPath.CONTEXTS_PATH_PART); HttpURLConnection httpURLConnection = gxHTTPStringRequest.get(); - String jsonArray = HTTPUtility.getResponse(String.class, httpURLConnection); + String objectNode = HTTPUtility.getResponse(String.class, httpURLConnection); - logger.info("Contexts of {} with UUID {} are {}", type, uuid, jsonArray); + logger.info("Contexts of {} with UUID {} are {}", type, uuid, objectNode); - Set contexts = ContextUtility.getContextUUIDSet(jsonArray); + Map contexts = ContextUtility.getContextMap(objectNode); return contexts; } catch(ResourceRegistryException e) { // logger.trace("Error while getting {} with UUID {}", type, uuid, e);