diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c11e01..395114a 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 Publisher +## [v4.5.0-SNAPSHOT] + +- Added support for paginated results [#24648] + + ## [v4.4.0] - Migrated code to reorganized E/R format [#24992] diff --git a/pom.xml b/pom.xml index aa38667..6664ab3 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.gcube.information-system resource-registry-publisher - 4.4.0 + 4.5.0-SNAPSHOT Resource Registry Publisher Resource Registry Publisher is a library designed to interact with Resource Registry Instances APIs diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/publisher/ResourceRegistryPublisher.java b/src/main/java/org/gcube/informationsystem/resourceregistry/publisher/ResourceRegistryPublisher.java index b63b447..c997611 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/publisher/ResourceRegistryPublisher.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/publisher/ResourceRegistryPublisher.java @@ -10,6 +10,7 @@ import org.gcube.informationsystem.model.reference.entities.Facet; 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.resourceregistry.api.contexts.ContextCache; import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; @@ -51,6 +52,8 @@ public interface ResourceRegistryPublisher extends RequestInfo { public void addHeader(String name, String value); + public ContextCache getContextCache(); + /** * Use {@link #getContexts()} instead * @return an array containing all contexts definition diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/publisher/ResourceRegistryPublisherImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/publisher/ResourceRegistryPublisherImpl.java index e5374c4..cd21cbf 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/publisher/ResourceRegistryPublisherImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/publisher/ResourceRegistryPublisherImpl.java @@ -128,6 +128,18 @@ public class ResourceRegistryPublisherImpl extends BaseRequestInfo implements Re queryParams.put(AccessPath.INCLUDE_META_IN_ALL_INSTANCES_QUERY_PARAMETER, Boolean.toString(allMeta)); } } + + private void addOffset(Map queryParams) throws UnsupportedEncodingException{ + if(offset!=null) { + queryParams.put(AccessPath.OFFSET_QUERY_PARAMETER, offset.toString()); + } + } + + private void addLimit(Map queryParams) throws UnsupportedEncodingException{ + if(limit!=null) { + queryParams.put(AccessPath.LIMIT_QUERY_PARAMETER, limit.toString()); + } + } protected ContextCacheRenewal contextCacheRenewal = new ContextCacheRenewal() { @@ -215,6 +227,11 @@ public class ResourceRegistryPublisherImpl extends BaseRequestInfo implements Re public List getContexts() throws ResourceRegistryException { return contextCache.getContexts(); } + + @Override + public ContextCache getContextCache() { + return contextCache; + } /** * It reads the context from server. @@ -312,6 +329,8 @@ public class ResourceRegistryPublisherImpl extends BaseRequestInfo implements Re gxHTTPStringRequest.path(type); Map parameters = new HashMap<>(); + addOffset(parameters); + addLimit(parameters); parameters.put(InstancePath.POLYMORPHIC_QUERY_PARAMETER, polymorphic.toString()); includeAdditionalQueryParameters(gxHTTPStringRequest, parameters);