Reorganized query and path parameters constants
This commit is contained in:
parent
f115e9b4b9
commit
3b06356a26
|
@ -34,6 +34,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.queries.Inval
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.ContextPath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.QueryTemplatePath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.TypePath;
|
||||
|
@ -68,7 +69,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
if(queryParams==null) {
|
||||
queryParams = new HashMap<>();
|
||||
}
|
||||
queryParams.put(AccessPath.HIERARCHICAL_MODE_PARAM, Boolean.toString(true));
|
||||
queryParams.put(AccessPath.HIERARCHICAL_MODE_QUERY_PARAMETER, Boolean.toString(true));
|
||||
}
|
||||
return gxHTTPStringRequest.queryParams(queryParams);
|
||||
}
|
||||
|
@ -78,7 +79,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
if(queryParams==null) {
|
||||
queryParams = new HashMap<>();
|
||||
}
|
||||
queryParams.put(AccessPath.INCLUDE_CONTEXTS_IN_HEADER_PARAM, Boolean.toString(true));
|
||||
queryParams.put(AccessPath.INCLUDE_CONTEXTS_IN_HEADER_QUERY_PARAMETER, Boolean.toString(true));
|
||||
}
|
||||
return gxHTTPStringRequest.queryParams(queryParams);
|
||||
}
|
||||
|
@ -188,7 +189,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
ContextCache contextCache = ContextCache.getInstance();
|
||||
Context context = ContextCache.getInstance().getContextByUUID(uuid);;
|
||||
if(context == null) {
|
||||
context = getContextFromServer(AccessPath.CURRENT_CONTEXT);
|
||||
context = getContextFromServer(ContextPath.CURRENT_CONTEXT_PATH_PART);
|
||||
contextCache.cleanCache();
|
||||
contextCache.refreshContextsIfNeeded();
|
||||
Context c = contextCache.getContextByUUID(context.getHeader().getUUID());
|
||||
|
@ -208,7 +209,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
UUID uuid = contextCache.getUUIDByFullName(contextFullName);
|
||||
Context context = null;
|
||||
if(uuid == null) {
|
||||
context = getContextFromServer(AccessPath.CURRENT_CONTEXT);
|
||||
context = getContextFromServer(ContextPath.CURRENT_CONTEXT_PATH_PART);
|
||||
contextCache.cleanCache();
|
||||
contextCache.refreshContextsIfNeeded();
|
||||
Context c = contextCache.getContextByUUID(context.getHeader().getUUID());
|
||||
|
@ -240,7 +241,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
gxHTTPStringRequest.path(typeName);
|
||||
|
||||
Map<String,String> parameters = new HashMap<>();
|
||||
parameters.put(InstancePath.POLYMORPHIC_PARAM, Boolean.FALSE.toString());
|
||||
parameters.put(InstancePath.POLYMORPHIC_QUERY_PARAMETER, Boolean.FALSE.toString());
|
||||
gxHTTPStringRequest.queryParams(parameters);
|
||||
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.head();
|
||||
|
@ -287,7 +288,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
gxHTTPStringRequest.path(typeName);
|
||||
|
||||
Map<String,String> parameters = new HashMap<>();
|
||||
parameters.put(TypePath.POLYMORPHIC_PARAM, polymorphic.toString());
|
||||
parameters.put(TypePath.POLYMORPHIC_QUERY_PARAMETER, polymorphic.toString());
|
||||
gxHTTPStringRequest.queryParams(parameters);
|
||||
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.get();
|
||||
|
@ -332,7 +333,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
gxHTTPStringRequest.path(type);
|
||||
|
||||
Map<String,String> parameters = new HashMap<>();
|
||||
parameters.put(InstancePath.POLYMORPHIC_PARAM, polymorphic.toString());
|
||||
parameters.put(InstancePath.POLYMORPHIC_QUERY_PARAMETER, polymorphic.toString());
|
||||
includeAdditionalQueryParameters(gxHTTPStringRequest, parameters);
|
||||
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.get();
|
||||
|
@ -449,8 +450,8 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
gxHTTPStringRequest.path(AccessPath.QUERY_PATH_PART);
|
||||
|
||||
Map<String,String> parameters = new HashMap<>();
|
||||
parameters.put(AccessPath.QUERY_PARAM, query);
|
||||
parameters.put(AccessPath.RAW_PARAM, Boolean.toString(raw));
|
||||
parameters.put(AccessPath.Q_QUERY_PARAMETER, query);
|
||||
parameters.put(AccessPath.RAW_QUERY_PARAMETER, Boolean.toString(raw));
|
||||
|
||||
includeAdditionalQueryParameters(gxHTTPStringRequest, parameters);
|
||||
|
||||
|
@ -484,8 +485,8 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
gxHTTPStringRequest.path(referenceEntityType);
|
||||
|
||||
Map<String,String> parameters = new HashMap<>();
|
||||
parameters.put(AccessPath._DIRECTION_PARAM, direction.name());
|
||||
parameters.put(AccessPath._POLYMORPHIC_PARAM, polymorphic.toString());
|
||||
parameters.put(AccessPath._DIRECTION_QUERY_PARAMETER, direction.name());
|
||||
parameters.put(AccessPath._POLYMORPHIC_QUERY_PARAMETER, polymorphic.toString());
|
||||
|
||||
if(referenceEntity == null) {
|
||||
if(facetConstraints != null && facetConstraints.size() > 0) {
|
||||
|
@ -499,7 +500,7 @@ public class ResourceRegistryClientImpl implements ResourceRegistryClient {
|
|||
} else {
|
||||
logger.info("Going to get {} linked by {} to {} with UUID {}", entityType, relationType,
|
||||
referenceEntityType, referenceEntity);
|
||||
parameters.put(AccessPath._REFERENCE_PARAM, referenceEntity.toString());
|
||||
parameters.put(AccessPath._REFERENCE_QUERY_PARAMETER, referenceEntity.toString());
|
||||
}
|
||||
|
||||
includeAdditionalQueryParameters(gxHTTPStringRequest, parameters);
|
||||
|
|
Loading…
Reference in New Issue