Fixing getAllContextsFromServer()

This commit is contained in:
luca.frosini 2023-11-09 19:04:12 +01:00
parent c26b70520a
commit 85cb4a4e55
1 changed files with 8 additions and 4 deletions

View File

@ -116,6 +116,10 @@ public class ResourceRegistryClientImpl extends BaseRequestInfo implements Resou
} }
private void addIncludeMeta(Map<String,String> queryParams) throws UnsupportedEncodingException{ private void addIncludeMeta(Map<String,String> queryParams) throws UnsupportedEncodingException{
addIncludeMeta(queryParams, includeMeta);
}
private void addIncludeMeta(Map<String,String> queryParams, boolean includeMeta) throws UnsupportedEncodingException{
if(includeMeta) { if(includeMeta) {
queryParams.put(AccessPath.INCLUDE_META_QUERY_PARAMETER, Boolean.toString(includeMeta)); queryParams.put(AccessPath.INCLUDE_META_QUERY_PARAMETER, Boolean.toString(includeMeta));
} }
@ -151,7 +155,7 @@ public class ResourceRegistryClientImpl extends BaseRequestInfo implements Resou
@Override @Override
public List<Context> renew() throws ResourceRegistryException { public List<Context> renew() throws ResourceRegistryException {
return getAllContextFromServer(0, BaseRequestInfo.UNBOUNDED_LIMIT); return getAllContextFromServer(true, 0, BaseRequestInfo.UNBOUNDED_LIMIT);
} }
}; };
@ -200,10 +204,10 @@ public class ResourceRegistryClientImpl extends BaseRequestInfo implements Resou
* @throws ResourceRegistryException * @throws ResourceRegistryException
*/ */
public List<Context> getAllContextFromServer() throws ResourceRegistryException { public List<Context> getAllContextFromServer() throws ResourceRegistryException {
return getAllContextFromServer(offset, limit); return getAllContextFromServer(includeMeta, offset, limit);
} }
protected List<Context> getAllContextFromServer(Integer offset, Integer limit) throws ResourceRegistryException { protected List<Context> getAllContextFromServer(boolean includeMeta, Integer offset, Integer limit) throws ResourceRegistryException {
try { try {
logger.info("Going to read all {}s", Context.NAME); logger.info("Going to read all {}s", Context.NAME);
GXHTTPStringRequest gxHTTPStringRequest = getGXHTTPStringRequest(); GXHTTPStringRequest gxHTTPStringRequest = getGXHTTPStringRequest();
@ -212,7 +216,7 @@ public class ResourceRegistryClientImpl extends BaseRequestInfo implements Resou
gxHTTPStringRequest.path(AccessPath.CONTEXTS_PATH_PART); gxHTTPStringRequest.path(AccessPath.CONTEXTS_PATH_PART);
Map<String,String> parameters = new HashMap<>(); Map<String,String> parameters = new HashMap<>();
addIncludeMeta(parameters); addIncludeMeta(parameters, includeMeta);
addOffset(parameters, offset); addOffset(parameters, offset);
addLimit(parameters, limit); addLimit(parameters, limit);
gxHTTPStringRequest.queryParams(parameters); gxHTTPStringRequest.queryParams(parameters);