Added support for context names included in header among UUIDs refs
#22090
This commit is contained in:
parent
351500e701
commit
882f26ac12
|
@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
- Aligned overrided APIs [#21979]
|
||||
- Getting all the relations of a type it is returned a list of relations and not the list of Resources sources of such relation [#22003]
|
||||
- Added check for reserved UUID
|
||||
- Added support for context names included in header among UUIDs [#22090]
|
||||
|
||||
## [v4.1.0]
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.informationsystem.resourceregistry.publisher;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.contexts.reference.entities.Context;
|
||||
|
@ -226,10 +226,10 @@ public interface ResourceRegistryPublisher {
|
|||
public List<ERElement> removeFromCurrentContext(ERElement er, Boolean dryRun)
|
||||
throws SchemaViolationException, NotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public Set<UUID> getElementContexts(String type, UUID instanceUUID)
|
||||
public Map<UUID, String> getElementContexts(String type, UUID instanceUUID)
|
||||
throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
public <ERElem extends ERElement> Set<UUID> getElementContexts(ERElem er)
|
||||
public <ERElem extends ERElement> Map<UUID, String> getElementContexts(ERElem er)
|
||||
throws NotFoundException, ResourceRegistryException;
|
||||
|
||||
/* ----- */
|
||||
|
@ -258,10 +258,10 @@ public interface ResourceRegistryPublisher {
|
|||
public <R extends Resource> List<ERElement> removeResourceFromCurrentContext(R resource, Boolean dryRun)
|
||||
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public Set<UUID> getResourceContexts(String resourceType, UUID resourceUUID)
|
||||
public Map<UUID, String> getResourceContexts(String resourceType, UUID resourceUUID)
|
||||
throws ResourceNotFoundException, ResourceRegistryException;
|
||||
|
||||
public <R extends Resource> Set<UUID> getResourceContexts(R resource)
|
||||
public <R extends Resource> Map<UUID, String> getResourceContexts(R resource)
|
||||
throws ResourceNotFoundException, ResourceRegistryException;
|
||||
|
||||
/* ----- */
|
||||
|
@ -290,10 +290,10 @@ public interface ResourceRegistryPublisher {
|
|||
public <F extends Facet> List<ERElement> removeFacetFromCurrentContext(F facet, Boolean dryRun)
|
||||
throws SchemaViolationException, FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
|
||||
|
||||
public Set<UUID> getFacetContexts(String facetType, UUID facetUUID)
|
||||
public Map<UUID, String> getFacetContexts(String facetType, UUID facetUUID)
|
||||
throws FacetNotFoundException, ResourceRegistryException;
|
||||
|
||||
public <F extends Facet> Set<UUID> getFacetContexts(F facet)
|
||||
public <F extends Facet> Map<UUID, String> getFacetContexts(F facet)
|
||||
throws FacetNotFoundException, 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;
|
||||
|
@ -906,7 +905,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getElementContexts(String type, UUID instanceUUID)
|
||||
public Map<UUID, String> getElementContexts(String type, UUID instanceUUID)
|
||||
throws NotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to get contexts of {} with UUID {}", type, instanceUUID);
|
||||
|
@ -918,10 +917,11 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
gxHTTPStringRequest.path(SharingPath.CONTEXTS_PATH_PART);
|
||||
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.get();
|
||||
String jsonArray = HTTPUtility.getResponse(String.class, httpURLConnection);
|
||||
Set<UUID> contexts = ContextUtility.getContextUUIDSet(jsonArray);
|
||||
|
||||
logger.info("Contexts of {} with UUID {} are {}", type, instanceUUID, contexts);
|
||||
String objectNode = HTTPUtility.getResponse(String.class, httpURLConnection);
|
||||
|
||||
logger.info("Contexts of {} with UUID {} are {}", type, instanceUUID, objectNode);
|
||||
|
||||
Map<UUID, String> contexts = ContextUtility.getContextMap(objectNode);
|
||||
|
||||
return contexts;
|
||||
|
||||
|
@ -935,7 +935,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public <ERElem extends ERElement> Set<UUID> getElementContexts(ERElem er)
|
||||
public <ERElem extends ERElement> Map<UUID, String> getElementContexts(ERElem er)
|
||||
throws NotFoundException, ResourceRegistryException {
|
||||
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility.getTypeName(er);
|
||||
UUID instanceUUID = er.getHeader().getUUID();
|
||||
|
@ -991,13 +991,13 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getResourceContexts(String resourceType, UUID resourceUUID)
|
||||
public Map<UUID, String> getResourceContexts(String resourceType, UUID resourceUUID)
|
||||
throws ResourceNotFoundException, ResourceRegistryException {
|
||||
return getElementContexts(resourceType, resourceUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends Resource> Set<UUID> getResourceContexts(R resource)
|
||||
public <R extends Resource> Map<UUID, String> getResourceContexts(R resource)
|
||||
throws ResourceNotFoundException, ResourceRegistryException {
|
||||
return getElementContexts(resource);
|
||||
}
|
||||
|
@ -1051,13 +1051,13 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getFacetContexts(String facetType, UUID facetUUID)
|
||||
public Map<UUID, String> getFacetContexts(String facetType, UUID facetUUID)
|
||||
throws FacetNotFoundException, ResourceRegistryException {
|
||||
return getElementContexts(facetType, facetUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <F extends Facet> Set<UUID> getFacetContexts(F facet)
|
||||
public <F extends Facet> Map<UUID, String> getFacetContexts(F facet)
|
||||
throws FacetNotFoundException, ResourceRegistryException {
|
||||
return getElementContexts(facet);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue