From 29b559a71a636994e6e4164faffb26fca5877ea8 Mon Sep 17 00:00:00 2001 From: "luca.frosini" Date: Fri, 27 Oct 2023 15:05:44 +0200 Subject: [PATCH] Added getContextCache() to be able to get Context as Tree --- CHANGELOG.md | 5 +++++ pom.xml | 2 +- .../client/ResourceRegistryClient.java | 3 +++ .../client/ResourceRegistryClientImpl.java | 11 +++++++++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea0fba2..cbe573f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm # Changelog for Resource Registry Client +## [v4.5.0-SNAPSHOT] + +- Added getContextCache() to be able to get Context as Tree [#24555] + + ## [v4.4.0] - Migrated code to reorganized E/R format [#24992] diff --git a/pom.xml b/pom.xml index bf67558..f544926 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.gcube.information-system resource-registry-client - 4.4.0 + 4.5.0-SNAPSHOT Resource Registry Client Resource Registry Client is a library designed to interact with idempotent Resource Registry APIs 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 094e61f..280ceb2 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClient.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClient.java @@ -14,6 +14,7 @@ import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate; +import org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache; import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; @@ -48,6 +49,8 @@ public interface ResourceRegistryClient extends RequestInfo { public List getAllContext() throws ResourceRegistryException; + public ContextCache getContextCache(); + public boolean existContext(String uuid) throws ContextNotFoundException, ResourceRegistryException; public boolean existContext(UUID uuid) throws ContextNotFoundException, 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 2de849d..8969585 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/client/ResourceRegistryClientImpl.java @@ -15,13 +15,12 @@ import org.gcube.common.gxhttp.reference.GXConnection; import org.gcube.common.gxhttp.request.GXHTTPStringRequest; import org.gcube.common.http.GXHTTPUtility; import org.gcube.informationsystem.base.reference.Direction; -import org.gcube.informationsystem.base.reference.IdentifiableElement; import org.gcube.informationsystem.contexts.reference.entities.Context; +import org.gcube.informationsystem.model.knowledge.ModelKnowledge; import org.gcube.informationsystem.model.reference.ERElement; import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; -import org.gcube.informationsystem.model.reference.properties.Metadata; import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.Relation; @@ -45,6 +44,7 @@ import org.gcube.informationsystem.resourceregistry.api.rest.TypePath; import org.gcube.informationsystem.resourceregistry.api.rest.httputils.HTTPUtility; import org.gcube.informationsystem.serialization.ElementMapper; import org.gcube.informationsystem.types.TypeMapper; +import org.gcube.informationsystem.types.knowledge.TypeInformation; import org.gcube.informationsystem.types.reference.Type; import org.gcube.informationsystem.utils.TypeUtility; import org.slf4j.Logger; @@ -66,6 +66,8 @@ public class ResourceRegistryClientImpl extends BaseRequestInfo implements Resou protected ContextCache contextCache; + protected ModelKnowledge modelKnowledge; + @Deprecated @Override public boolean isIncludeContextsInHeader() { @@ -203,6 +205,11 @@ public class ResourceRegistryClientImpl extends BaseRequestInfo implements Resou return contextCache.getContexts(); } + @Override + public ContextCache getContextCache() { + return contextCache; + } + /** * It reads the context from server. * The cache used for contexts is bypassed and not updated.