Added support for context names included in header among UUIDs refs
#22090
This commit is contained in:
parent
57d0a5dbc4
commit
e907c029f9
|
@ -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]
|
||||
|
||||
|
|
|
@ -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<Context> getAllContext() throws ResourceRegistryException;
|
||||
|
||||
public <ERElem extends ERElement> Set<UUID> getInstanceContexts(Class<ERElem> clazz, UUID uuid)
|
||||
public <ERElem extends ERElement> Map<UUID, String> getInstanceContexts(Class<ERElem> clazz, UUID uuid)
|
||||
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException;
|
||||
|
||||
public Set<UUID> getInstanceContexts(String type, UUID uuid)
|
||||
public Map<UUID, String> getInstanceContexts(String type, UUID uuid)
|
||||
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException;
|
||||
|
||||
}
|
||||
|
|
|
@ -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 <ERElem extends ERElement> Set<UUID> getInstanceContexts(Class<ERElem> clazz, UUID uuid)
|
||||
public <ERElem extends ERElement> Map<UUID, String> getInstanceContexts(Class<ERElem> clazz, UUID uuid)
|
||||
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException {
|
||||
String typeName = Utility.getTypeName(clazz);
|
||||
return getInstanceContexts(typeName, uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getInstanceContexts(String type, UUID uuid)
|
||||
public Map<UUID, String> 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<UUID> contexts = ContextUtility.getContextUUIDSet(jsonArray);
|
||||
Map<UUID, String> contexts = ContextUtility.getContextMap(objectNode);
|
||||
return contexts;
|
||||
} catch(ResourceRegistryException e) {
|
||||
// logger.trace("Error while getting {} with UUID {}", type, uuid, e);
|
||||
|
|
Loading…
Reference in New Issue