Fixed paths and called methods

This commit is contained in:
Luca Frosini 2023-05-16 15:12:26 +02:00
parent c7b9d21bba
commit 46f0bea227
1 changed files with 13 additions and 8 deletions

View File

@ -60,8 +60,10 @@ public class Access extends BaseRest {
public static final String RELATION_TYPE_PATH_PARAMETER = "RELATION_TYPE_NAME";
public static final String REFERENCE_TYPE_PATH_PARAMETER = "REFERENCE_TYPE_NAME";
public static final String RAW_QUERY_METHOD = "raw";
public static final String GRAPH_QUERY_METHOD = "graph";
public static final String JSON_QUERY_METHOD = "json";
public static final String PREPARED_QUERY_METHOD = "prepared";
public Access() {
super();
@ -109,6 +111,7 @@ public class Access extends BaseRest {
return contextManagement.readAsString();
}
/*
* GET /access/types/{TYPE_NAME}[?polymorphic=false]
* e.g. GET /access/types/ContactFacet?polymorphic=true
@ -135,8 +138,7 @@ public class Access extends BaseRest {
throw new ResourceRegistryException(e);
}
}
/*
* GET /access/query-templates
*/
@ -161,7 +163,7 @@ public class Access extends BaseRest {
* e.g. GET /access/query-templates/GetAllEServiceWithState
*/
@GET
@Path(AccessPath.QUERY_TEMPLATES_PATH_PART + "{" + QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER + "}")
@Path(AccessPath.QUERY_TEMPLATES_PATH_PART + "/{" + QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER + "}")
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String readQueryTemplate(@PathParam(QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER) String queryTemplateName)
throws NotFoundException, ResourceRegistryException {
@ -283,9 +285,7 @@ public class Access extends BaseRest {
erManagement.setUUID(UUID.fromString(uuid));
return erManagement.read().toString();
}
/*
* GET /access/instances/{TYPE_NAME}/{UUID}/contexts
* e.g. GET /access/instances/ContactFacet/4023d5b2-8601-47a5-83ef-49ffcbfc7d86/contexts
@ -304,6 +304,7 @@ public class Access extends BaseRest {
return erManagement.getContexts();
}
/**
* It includeSubtypes to query Entities and Relations in the current Context.<br />
* It accepts idempotent query only.. <br />
@ -328,7 +329,11 @@ public class Access extends BaseRest {
@QueryParam(AccessPath.RAW_QUERY_PARAMETER) @DefaultValue(AccessPath.RAW_QUERY_PARAMETER_DEFAULT_VALUE) Boolean raw)
throws InvalidQueryException {
logger.info("Requested query (Raw {}):\n{}", raw, query);
setAccountingMethod(Method.QUERY, GRAPH_QUERY_METHOD);
if(raw) {
setAccountingMethod(Method.QUERY, RAW_QUERY_METHOD);
}else {
setAccountingMethod(Method.QUERY, GRAPH_QUERY_METHOD);
}
ServerRequestInfo serverRequestInfo = initRequestInfo();
if(raw) {
@ -438,7 +443,7 @@ public class Access extends BaseRest {
logger.info("Requested {} instances having a(n) {} ({}={}} with {} ({}={}). Request URI is {})", resourcetype, relationType,
AccessPath._DIRECTION_QUERY_PARAMETER, direction, referenceType, AccessPath._POLYMORPHIC_QUERY_PARAMETER, polymorphic, uriInfo.getRequestUri());
setAccountingMethod(Method.QUERY, "");
setAccountingMethod(Method.QUERY, PREPARED_QUERY_METHOD);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.checkAllQueryParameters();