Added support for paginated results
This commit is contained in:
parent
3670c234a4
commit
88ef977959
|
@ -2,6 +2,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
|
|
||||||
# Changelog for Resource Registry Publisher
|
# Changelog for Resource Registry Publisher
|
||||||
|
|
||||||
|
## [v4.5.0-SNAPSHOT]
|
||||||
|
|
||||||
|
- Added support for paginated results [#24648]
|
||||||
|
|
||||||
|
|
||||||
## [v4.4.0]
|
## [v4.4.0]
|
||||||
|
|
||||||
- Migrated code to reorganized E/R format [#24992]
|
- Migrated code to reorganized E/R format [#24992]
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.information-system</groupId>
|
<groupId>org.gcube.information-system</groupId>
|
||||||
<artifactId>resource-registry-publisher</artifactId>
|
<artifactId>resource-registry-publisher</artifactId>
|
||||||
<version>4.4.0</version>
|
<version>4.5.0-SNAPSHOT</version>
|
||||||
<name>Resource Registry Publisher</name>
|
<name>Resource Registry Publisher</name>
|
||||||
<description>Resource Registry Publisher is a library designed to interact with Resource Registry Instances APIs</description>
|
<description>Resource Registry Publisher is a library designed to interact with Resource Registry Instances APIs</description>
|
||||||
|
|
||||||
|
|
|
@ -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.entities.Resource;
|
||||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||||
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
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.AlreadyPresentException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
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 void addHeader(String name, String value);
|
||||||
|
|
||||||
|
public ContextCache getContextCache();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use {@link #getContexts()} instead
|
* Use {@link #getContexts()} instead
|
||||||
* @return an array containing all contexts definition
|
* @return an array containing all contexts definition
|
||||||
|
|
|
@ -129,6 +129,18 @@ public class ResourceRegistryPublisherImpl extends BaseRequestInfo implements Re
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addOffset(Map<String,String> queryParams) throws UnsupportedEncodingException{
|
||||||
|
if(offset!=null) {
|
||||||
|
queryParams.put(AccessPath.OFFSET_QUERY_PARAMETER, offset.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addLimit(Map<String,String> queryParams) throws UnsupportedEncodingException{
|
||||||
|
if(limit!=null) {
|
||||||
|
queryParams.put(AccessPath.LIMIT_QUERY_PARAMETER, limit.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected ContextCacheRenewal contextCacheRenewal = new ContextCacheRenewal() {
|
protected ContextCacheRenewal contextCacheRenewal = new ContextCacheRenewal() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -216,6 +228,11 @@ public class ResourceRegistryPublisherImpl extends BaseRequestInfo implements Re
|
||||||
return contextCache.getContexts();
|
return contextCache.getContexts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ContextCache getContextCache() {
|
||||||
|
return contextCache;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It reads the context from server.
|
* It reads the context from server.
|
||||||
* The cache used for contexts is bypassed and not updated.
|
* The cache used for contexts is bypassed and not updated.
|
||||||
|
@ -312,6 +329,8 @@ public class ResourceRegistryPublisherImpl extends BaseRequestInfo implements Re
|
||||||
gxHTTPStringRequest.path(type);
|
gxHTTPStringRequest.path(type);
|
||||||
|
|
||||||
Map<String,String> parameters = new HashMap<>();
|
Map<String,String> parameters = new HashMap<>();
|
||||||
|
addOffset(parameters);
|
||||||
|
addLimit(parameters);
|
||||||
parameters.put(InstancePath.POLYMORPHIC_QUERY_PARAMETER, polymorphic.toString());
|
parameters.put(InstancePath.POLYMORPHIC_QUERY_PARAMETER, polymorphic.toString());
|
||||||
includeAdditionalQueryParameters(gxHTTPStringRequest, parameters);
|
includeAdditionalQueryParameters(gxHTTPStringRequest, parameters);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue