Fixed limit management

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@146732 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-04-10 15:37:29 +00:00
parent 4b08a2c717
commit 8a20df8e90
2 changed files with 7 additions and 4 deletions

View File

@ -19,7 +19,7 @@ public interface Query {
* @throws InvalidQueryException
* http://orientdb.com/docs/last/OrientDB-REST.html#query
*/
public String query(String query, int limit, String fetchPlan)
public String query(String query, Integer limit, String fetchPlan)
throws InvalidQueryException;
}

View File

@ -8,6 +8,7 @@ import java.io.Writer;
import java.util.List;
import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException;
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode;
import org.gcube.informationsystem.resourceregistry.utils.Utility;
@ -121,10 +122,12 @@ public class QueryImpl implements Query {
*/
@Override
public String query(String query, int limit, String fetchPlan)
public String query(String query, Integer limit, String fetchPlan)
throws InvalidQueryException {
limit = (limit <= 0) ? -1 : limit;
if(limit == null){
limit = AccessPath.DEFAULT_LIMIT;
}
limit = (limit <= 0) ? AccessPath.UNBOUNDED : limit;
ODatabaseDocumentTx oDatabaseDocumentTx = null;