Compare commits

...

3 Commits

Author SHA1 Message Date
luca.frosini 85935c71d7 Added expiring time for ModelKnowledge 2023-10-31 15:44:38 +01:00
luca.frosini ae136f9567 The client must not enforce the pagination. It is a server side issue 2023-10-31 15:33:03 +01:00
luca.frosini e1b1f23e81 Improving offset limit management to properly support paginated result 2023-10-31 15:25:08 +01:00
5 changed files with 29 additions and 22 deletions

View File

@ -51,7 +51,7 @@ public class ContextCache {
protected ContextCacheRenewal contextCacheRenewal; protected ContextCacheRenewal contextCacheRenewal;
// in millisec used for logging purposes only // in millisec used only for logging and debugging
protected Calendar creationTime; protected Calendar creationTime;
// in millisec // in millisec
protected Calendar expiringTime; protected Calendar expiringTime;

View File

@ -8,21 +8,21 @@ import org.gcube.informationsystem.model.reference.properties.Metadata;
*/ */
public class BaseRequestInfo implements RequestInfo { public class BaseRequestInfo implements RequestInfo {
public static final Integer DEFAULT_LIMIT = 10;
public static final Integer UNBOUNDED_LIMIT = -1;
public static final Integer DEFAULT_OFFSET = 0; public static final Integer DEFAULT_OFFSET = 0;
public static final Integer DEFAULT_LIMIT = 10;
public static final Integer UNBOUNDED_LIMIT = -1;
/**
* The offset parameter indicates the starting position of the result.
*/
protected Integer offset;
/** /**
* To get unlimited results the limit query parameters must be set to -1. * To get unlimited results the limit query parameters must be set to -1.
* If the results are too much the operation could have a timeout. * If the results are too much the operation could have a timeout.
*/ */
protected int limit; protected Integer limit;
/**
* The offset parameter indicates the starting position of the result.
*/
protected int offset;
/** /**
* Track if the request requested to include {@link Metadata} * Track if the request requested to include {@link Metadata}
@ -47,8 +47,12 @@ public class BaseRequestInfo implements RequestInfo {
protected boolean includeContexts; protected boolean includeContexts;
public BaseRequestInfo() { public BaseRequestInfo() {
this.limit = BaseRequestInfo.DEFAULT_LIMIT; this(null, null);
this.offset = BaseRequestInfo.DEFAULT_OFFSET; }
public BaseRequestInfo(Integer offset, Integer limit) {
this.offset = offset;
this.limit = limit;
this.includeMeta = false; this.includeMeta = false;
this.allMeta = false; this.allMeta = false;
this.hierarchicalMode = false; this.hierarchicalMode = false;
@ -56,22 +60,22 @@ public class BaseRequestInfo implements RequestInfo {
} }
@Override @Override
public int getLimit() { public Integer getLimit() {
return limit; return limit;
} }
@Override @Override
public void setLimit(int limit) { public void setLimit(Integer limit) {
this.limit = limit; this.limit = limit;
} }
@Override @Override
public int getOffset() { public Integer getOffset() {
return offset; return offset;
} }
@Override @Override
public void setOffset(int offset) { public void setOffset(Integer offset) {
this.offset = offset; this.offset = offset;
} }

View File

@ -5,13 +5,13 @@ package org.gcube.informationsystem.resourceregistry.api.request;
*/ */
public interface RequestInfo { public interface RequestInfo {
public int getLimit(); public Integer getLimit();
public void setLimit(int limit); public void setLimit(Integer limit);
public int getOffset(); public Integer getOffset();
public void setOffset(int offset); public void setOffset(Integer offset);
public boolean includeMeta(); public boolean includeMeta();

View File

@ -22,6 +22,10 @@ public class AccessPath {
public static final String INCLUDE_META_QUERY_PARAMETER = InstancePath.INCLUDE_META_QUERY_PARAMETER; public static final String INCLUDE_META_QUERY_PARAMETER = InstancePath.INCLUDE_META_QUERY_PARAMETER;
public static final String INCLUDE_META_IN_ALL_INSTANCES_QUERY_PARAMETER = InstancePath.INCLUDE_META_IN_ALL_INSTANCES_QUERY_PARAMETER; public static final String INCLUDE_META_IN_ALL_INSTANCES_QUERY_PARAMETER = InstancePath.INCLUDE_META_IN_ALL_INSTANCES_QUERY_PARAMETER;
public static final String OFFSET_QUERY_PARAMETER = InstancePath.OFFSET_QUERY_PARAMETER;
public static final String LIMIT_QUERY_PARAMETER = InstancePath.LIMIT_QUERY_PARAMETER;
/** /**
* Used only in getRelated() function * Used only in getRelated() function
* The _ is prepended to avoid clash with field name * The _ is prepended to avoid clash with field name

View File

@ -10,9 +10,8 @@ public class InstancePath {
public static final String INSTANCES_PATH_PART = "instances"; public static final String INSTANCES_PATH_PART = "instances";
public static final String LIMIT_QUERY_PARAMETER = "limit";
public static final String OFFSET_QUERY_PARAMETER = "offset"; public static final String OFFSET_QUERY_PARAMETER = "offset";
public static final String LIMIT_QUERY_PARAMETER = "limit";
public static final String POLYMORPHIC_QUERY_PARAMETER = "polymorphic"; public static final String POLYMORPHIC_QUERY_PARAMETER = "polymorphic";