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
|
||||
|
||||
## [v4.5.0-SNAPSHOT]
|
||||
|
||||
- Added support for paginated results [#24648]
|
||||
|
||||
|
||||
## [v4.4.0]
|
||||
|
||||
- Migrated code to reorganized E/R format [#24992]
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -9,7 +9,7 @@
|
|||
|
||||
<groupId>org.gcube.information-system</groupId>
|
||||
<artifactId>resource-registry-publisher</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<version>4.5.0-SNAPSHOT</version>
|
||||
<name>Resource Registry Publisher</name>
|
||||
<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.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
|
||||
|
|
|
@ -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<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() {
|
||||
|
||||
|
@ -215,6 +227,11 @@ public class ResourceRegistryPublisherImpl extends BaseRequestInfo implements Re
|
|||
public List<Context> 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<String,String> parameters = new HashMap<>();
|
||||
addOffset(parameters);
|
||||
addLimit(parameters);
|
||||
parameters.put(InstancePath.POLYMORPHIC_QUERY_PARAMETER, polymorphic.toString());
|
||||
includeAdditionalQueryParameters(gxHTTPStringRequest, parameters);
|
||||
|
||||
|
|
Loading…
Reference in New Issue