Added query parameters to get paginated results
This commit is contained in:
parent
19f1614a15
commit
25fffa886d
|
@ -0,0 +1,114 @@
|
|||
package org.gcube.informationsystem.resourceregistry.api.request;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.IdentifiableElement;
|
||||
import org.gcube.informationsystem.model.reference.properties.Metadata;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class BaseRequestInfo implements RequestInfo {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
protected int limit;
|
||||
|
||||
/**
|
||||
* The offset parameter indicates the starting position of the result.
|
||||
*/
|
||||
protected int offset;
|
||||
|
||||
|
||||
/**
|
||||
* Track if the request requested to include {@link Metadata}
|
||||
*/
|
||||
protected boolean includeMeta;
|
||||
|
||||
/**
|
||||
* Track if the request requested to include {@link Metadata} in all
|
||||
* {@link IdentifiableElement} or just in the root instance
|
||||
*/
|
||||
protected boolean allMeta;
|
||||
|
||||
|
||||
/**
|
||||
* Track if hierarchicalMode has been requested
|
||||
*/
|
||||
protected boolean hierarchicalMode;
|
||||
|
||||
/**
|
||||
* Track if the request requested to include contexts
|
||||
*/
|
||||
protected boolean includeContexts;
|
||||
|
||||
public BaseRequestInfo() {
|
||||
this.limit = 10;
|
||||
this.offset = 0;
|
||||
this.includeMeta = false;
|
||||
this.allMeta = false;
|
||||
this.hierarchicalMode = false;
|
||||
this.includeContexts = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLimit(int limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOffset(int offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean includeMeta() {
|
||||
return includeMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIncludeMeta(boolean includeMeta) {
|
||||
this.includeMeta = includeMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allMeta() {
|
||||
return allMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllMeta(boolean allMeta) {
|
||||
this.allMeta = allMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHierarchicalMode() {
|
||||
return hierarchicalMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHierarchicalMode(boolean hierarchicalMode) {
|
||||
this.hierarchicalMode = hierarchicalMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean includeContexts() {
|
||||
return includeContexts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIncludeContexts(boolean includeContexts) {
|
||||
this.includeContexts = includeContexts;
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,14 @@ package org.gcube.informationsystem.resourceregistry.api.request;
|
|||
*/
|
||||
public interface RequestInfo {
|
||||
|
||||
public int getLimit();
|
||||
|
||||
public void setLimit(int limit);
|
||||
|
||||
public int getOffset();
|
||||
|
||||
public void setOffset(int offset);
|
||||
|
||||
public boolean includeMeta();
|
||||
|
||||
public void setIncludeMeta(boolean includeMeta);
|
||||
|
|
|
@ -10,6 +10,10 @@ public class InstancePath {
|
|||
|
||||
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 POLYMORPHIC_QUERY_PARAMETER = "polymorphic";
|
||||
|
||||
public static final String HIERARCHICAL_MODE_QUERY_PARAMETER = "hierarchical";
|
||||
|
|
|
@ -8,6 +8,7 @@ public class QueryTemplatePath {
|
|||
public static final String QUERY_TEMPLATES_PATH_PART = "query-templates";
|
||||
|
||||
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;
|
||||
|
||||
}
|
Loading…
Reference in New Issue