Rationalised accounting methods

This commit is contained in:
Luca Frosini 2023-05-16 14:59:21 +02:00
parent c79b579925
commit c7b9d21bba
8 changed files with 114 additions and 43 deletions

View File

@ -21,7 +21,6 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate;
import org.gcube.informationsystem.resourceregistry.ResourceInitializer;
@ -61,6 +60,9 @@ 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 GRAPH_QUERY_METHOD = "graph";
public static final String JSON_QUERY_METHOD = "json";
public Access() {
super();
}
@ -73,7 +75,7 @@ public class Access extends BaseRest {
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String getAllContexts() throws ResourceRegistryException {
logger.info("Requested to read all {}s", org.gcube.informationsystem.contexts.reference.entities.Context.NAME);
CalledMethodProvider.instance.set("listContexts");
setAccountingMethod(Method.LIST, org.gcube.informationsystem.contexts.reference.entities.Context.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.setAllMeta(true);
@ -96,7 +98,7 @@ public class Access extends BaseRest {
uuid = ContextUtility.getCurrentSecurityContext().getUUID().toString();
}
logger.info("Requested to read {} with id {} ", org.gcube.informationsystem.contexts.reference.entities.Context.NAME, uuid);
CalledMethodProvider.instance.set("readContext");
setAccountingMethod(Method.READ, org.gcube.informationsystem.contexts.reference.entities.Context.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.setAllMeta(true);
@ -118,7 +120,7 @@ public class Access extends BaseRest {
@QueryParam(TypePath.POLYMORPHIC_QUERY_PARAMETER) @DefaultValue("false") Boolean polymorphic)
throws SchemaNotFoundException, ResourceRegistryException {
logger.info("Requested Schema for type {}", type);
CalledMethodProvider.instance.set("readType");
setAccountingMethod(Method.READ, Type.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.setAllMeta(true);
@ -144,7 +146,7 @@ public class Access extends BaseRest {
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String allQueryTemplates() throws NotFoundException, ResourceRegistryException {
logger.info("Requested to read all {}s", QueryTemplate.NAME);
CalledMethodProvider.instance.set("listQueryTemplates");
setAccountingMethod(Method.LIST, QueryTemplate.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.setAllMeta(true);
@ -161,10 +163,10 @@ public class Access extends BaseRest {
@GET
@Path(AccessPath.QUERY_TEMPLATES_PATH_PART + "{" + QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER + "}")
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String read(@PathParam(QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER) String queryTemplateName)
public String readQueryTemplate(@PathParam(QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER) String queryTemplateName)
throws NotFoundException, ResourceRegistryException {
logger.info("Requested {} with name", QueryTemplate.NAME, queryTemplateName);
CalledMethodProvider.instance.set("readQueryTemplate");
setAccountingMethod(Method.READ, QueryTemplate.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.setAllMeta(true);
@ -175,6 +177,30 @@ public class Access extends BaseRest {
return queryTemplateManagement.read();
}
/*
* POST /access/query-templates/{QUERY_TEMPLATE_NAME}
* e.g. POST /access/query-templates/GetAllEServiceWithState
*
* params = { "$state" : "ready" }
*
*/
@POST
@Path(AccessPath.QUERY_TEMPLATES_PATH_PART + "{" + QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER + "}")
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String run(@PathParam(QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER) String queryTemplateName, String params)
throws NotFoundException, InvalidQueryException, ResourceRegistryException {
logger.info("Requested {} with name", QueryTemplate.NAME, queryTemplateName);
setAccountingMethod(Method.RUN, QueryTemplate.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.checkAllQueryParameters();
QueryTemplateManagement queryTemplateManagement = new QueryTemplateManagement();
queryTemplateManagement.setName(queryTemplateName);
queryTemplateManagement.setParams(params);
return queryTemplateManagement.run();
}
/*
* GET /access/instances/{TYPE_NAME}[?polymorphic=true]
@ -188,7 +214,7 @@ public class Access extends BaseRest {
@QueryParam(InstancePath.POLYMORPHIC_QUERY_PARAMETER) @DefaultValue("true") Boolean polymorphic)
throws NotFoundException, ResourceRegistryException {
logger.info("Requested all {}instances of {}", polymorphic ? InstancePath.POLYMORPHIC_QUERY_PARAMETER + " " : "", type);
CalledMethodProvider.instance.set("listInstances");
setAccountingMethod(Method.LIST, InstancesManager.INSTANCE);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.checkAllQueryParameters();
@ -208,7 +234,7 @@ public class Access extends BaseRest {
public Response instanceExists(@PathParam(TypeManager.TYPE_PATH_PARAMETER) String type,
@PathParam(InstancesManager.UUID_PATH_PARAMETER) String uuid) throws NotFoundException, ResourceRegistryException {
logger.info("Requested to check if {} with id {} exists", type, uuid);
CalledMethodProvider.instance.set("existInstance");
setAccountingMethod(Method.EXIST, InstancesManager.INSTANCE);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.checkQueryParameter(InstancePath.HIERARCHICAL_MODE_QUERY_PARAMETER);
@ -245,7 +271,7 @@ public class Access extends BaseRest {
public String getInstance(@PathParam(TypeManager.TYPE_PATH_PARAMETER) String type,
@PathParam(InstancesManager.UUID_PATH_PARAMETER) String uuid) throws NotFoundException, ResourceRegistryException {
logger.info("Requested to read {} with id {}", type, uuid);
CalledMethodProvider.instance.set("readInstance");
setAccountingMethod(Method.READ, InstancesManager.INSTANCE);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.checkAllQueryParameters();
@ -271,7 +297,7 @@ public class Access extends BaseRest {
public String getInstanceContexts(@PathParam(TypeManager.TYPE_PATH_PARAMETER) String type,
@PathParam(InstancesManager.UUID_PATH_PARAMETER) String instanceId) throws NotFoundException, ResourceRegistryException {
logger.info("Requested to get contexts of {} with UUID {}", type, instanceId);
CalledMethodProvider.instance.set("getInstanceContexts");
setAccountingMethod(InstancesManager.GET_INSTANCE_CONTEXTS_METHOD);
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(type);
erManagement.setUUID(UUID.fromString(instanceId));
@ -302,7 +328,7 @@ 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);
CalledMethodProvider.instance.set("graphQuery");
setAccountingMethod(Method.QUERY, GRAPH_QUERY_METHOD);
ServerRequestInfo serverRequestInfo = initRequestInfo();
if(raw) {
@ -361,7 +387,7 @@ public class Access extends BaseRest {
@Path(AccessPath.QUERY_PATH_PART)
public String jsonQuery(String jsonQuery) throws InvalidQueryException, ResourceRegistryException {
logger.info("Requested json query \n{}", jsonQuery);
CalledMethodProvider.instance.set("jsonQuery");
setAccountingMethod(Method.QUERY, JSON_QUERY_METHOD);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.checkAllQueryParameters();
@ -412,7 +438,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());
CalledMethodProvider.instance.set("query");
setAccountingMethod(Method.QUERY, "");
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.checkAllQueryParameters();

View File

@ -3,6 +3,7 @@ package org.gcube.informationsystem.resourceregistry.rest;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
import org.gcube.informationsystem.resourceregistry.requests.RequestUtility;
import org.gcube.informationsystem.resourceregistry.requests.ServerRequestInfo;
import org.slf4j.Logger;
@ -21,6 +22,20 @@ public class BaseRest {
public BaseRest() {
}
protected void setAccountingMethod(String method) {
CalledMethodProvider.instance.set(method);
}
protected void setAccountingMethod(Method method, String type) {
StringBuffer accountingMethod = new StringBuffer();
accountingMethod.append(method.getPrefix());
accountingMethod.append(type);
accountingMethod.append(method.getSuffix());
setAccountingMethod(accountingMethod.toString());
}
protected ServerRequestInfo initRequestInfo() {
ServerRequestInfo requestInfo = new ServerRequestInfo();

View File

@ -30,7 +30,7 @@ import org.gcube.informationsystem.resourceregistry.requests.ServerRequestInfo;
public class ContextManager extends BaseRest {
public static final String CONTEXT_UUID_PATH_PARAMETER = "CONTEXT_UUID";
public ContextManager() {
super();
}
@ -44,7 +44,7 @@ public class ContextManager extends BaseRest {
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String all() throws ContextNotFoundException, ResourceRegistryException {
logger.info("Requested to read all {}s", Context.NAME);
CalledMethodProvider.instance.set("listContexts");
setAccountingMethod(Method.LIST, Context.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.setAllMeta(true);
@ -69,7 +69,7 @@ public class ContextManager extends BaseRest {
uuid = ContextUtility.getCurrentSecurityContext().getUUID().toString();
}
logger.info("Requested to read {} with id {} ", Context.NAME, uuid);
CalledMethodProvider.instance.set("readContext");
setAccountingMethod(Method.READ, Context.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.setAllMeta(true);
@ -94,7 +94,7 @@ public class ContextManager extends BaseRest {
public String updateCreate(@PathParam(ContextManager.CONTEXT_UUID_PATH_PARAMETER) String uuid, String json)
throws ResourceRegistryException {
logger.info("Requested to update/create {} with json {} ", Context.NAME, json);
CalledMethodProvider.instance.set("updateContext");
setAccountingMethod(Method.UPDATE, Context.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.setAllMeta(true);

View File

@ -16,7 +16,6 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
import org.gcube.informationsystem.resourceregistry.ResourceInitializer;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
@ -36,7 +35,10 @@ import org.gcube.informationsystem.resourceregistry.requests.ServerRequestInfo;
public class InstancesManager extends BaseRest {
public static final String UUID_PATH_PARAMETER = "UUID";
public static final String INSTANCE = "Instance";
public static final String GET_INSTANCE_CONTEXTS_METHOD = "getInstanceContexts";
public InstancesManager() {
super();
}
@ -54,7 +56,7 @@ public class InstancesManager extends BaseRest {
@QueryParam(InstancePath.POLYMORPHIC_QUERY_PARAMETER) @DefaultValue("true") Boolean polymorphic)
throws NotFoundException, ResourceRegistryException {
logger.info("Requested all {}instances of {}", polymorphic ? InstancePath.POLYMORPHIC_QUERY_PARAMETER + " " : "", type);
CalledMethodProvider.instance.set("listInstances");
setAccountingMethod(Method.LIST, InstancesManager.INSTANCE);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.checkAllQueryParameters();
@ -75,7 +77,7 @@ public class InstancesManager extends BaseRest {
public Response exists(@PathParam(TypeManager.TYPE_PATH_PARAMETER) String type,
@PathParam(InstancesManager.UUID_PATH_PARAMETER) String uuid) throws NotFoundException, ResourceRegistryException {
logger.info("Requested to check if {} with id {} exists", type, uuid);
CalledMethodProvider.instance.set("existInstance");
setAccountingMethod(Method.EXIST, InstancesManager.INSTANCE);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.checkQueryParameter(InstancePath.HIERARCHICAL_MODE_QUERY_PARAMETER);
@ -113,7 +115,7 @@ public class InstancesManager extends BaseRest {
public String read(@PathParam(TypeManager.TYPE_PATH_PARAMETER) String type,
@PathParam(InstancesManager.UUID_PATH_PARAMETER) String uuid) throws NotFoundException, ResourceRegistryException {
logger.info("Requested to read {} with id {}", type, uuid);
CalledMethodProvider.instance.set("readInstance");
setAccountingMethod(Method.READ, InstancesManager.INSTANCE);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.checkAllQueryParameters();
@ -139,7 +141,7 @@ public class InstancesManager extends BaseRest {
@PathParam(InstancesManager.UUID_PATH_PARAMETER) String uuid, String json) throws ResourceRegistryException {
logger.info("Requested to update/create {} with id {}", type, uuid);
logger.trace("Requested to update/create {} with id {} with json {}", type, uuid, json);
CalledMethodProvider.instance.set("updateInstance");
setAccountingMethod(Method.UPDATE, InstancesManager.INSTANCE);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.checkIncludeQueryParameters();
@ -162,7 +164,7 @@ public class InstancesManager extends BaseRest {
public Response delete(@PathParam(TypeManager.TYPE_PATH_PARAMETER) String type,
@PathParam(InstancesManager.UUID_PATH_PARAMETER) String uuid) throws ResourceRegistryException {
logger.info("Requested to delete {} with id {}", type, uuid);
CalledMethodProvider.instance.set("deleteInstance");
setAccountingMethod(Method.DELETE, InstancesManager.INSTANCE);
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(type);
erManagement.setUUID(UUID.fromString(uuid));
@ -189,7 +191,7 @@ public class InstancesManager extends BaseRest {
@PathParam(ContextManager.CONTEXT_UUID_PATH_PARAMETER) String contextId)
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
logger.info("Requested to get contexts of {} with UUID {}", type, instanceId);
CalledMethodProvider.instance.set("getInstanceContexts");
setAccountingMethod(InstancesManager.GET_INSTANCE_CONTEXTS_METHOD);
@SuppressWarnings("rawtypes")
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);

View File

@ -0,0 +1,33 @@
package org.gcube.informationsystem.resourceregistry.rest;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public enum Method {
LIST("list","s"),
CREATE("create",""),
EXIST("exist",""),
READ("read",""),
UPDATE("update",""),
RUN("run",""),
DELETE("delete",""),
QUERY("","Query");
protected final String prefix;
protected final String suffix;
Method(String prefix, String suffix) {
this.prefix = prefix;
this.suffix = suffix;
}
public String getPrefix() {
return prefix;
}
public String getSuffix() {
return suffix;
}
}

View File

@ -12,7 +12,6 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate;
import org.gcube.informationsystem.resourceregistry.ResourceInitializer;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
@ -43,7 +42,7 @@ public class QueryTemplateManager extends BaseRest {
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String all() throws NotFoundException, ResourceRegistryException {
logger.info("Requested to read all {}s", QueryTemplate.NAME);
CalledMethodProvider.instance.set("listQueryTemplates");
setAccountingMethod(Method.LIST, QueryTemplate.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.setAllMeta(true);
@ -87,10 +86,10 @@ public class QueryTemplateManager extends BaseRest {
@Path("{" + QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER + "}")
@Consumes({MediaType.TEXT_PLAIN, ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8})
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public Response updateCreate(@PathParam(QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER) String queryTemplateName, String json)
public String updateCreate(@PathParam(QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER) String queryTemplateName, String json)
throws InvalidQueryException, ResourceRegistryException {
logger.info("Requested {} creation with name {} and content {}", QueryTemplate.NAME, queryTemplateName, json);
CalledMethodProvider.instance.set("createQueryTemplate");
setAccountingMethod(Method.UPDATE, QueryTemplate.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.setAllMeta(true);
@ -99,9 +98,7 @@ public class QueryTemplateManager extends BaseRest {
QueryTemplateManagement queryTemplateManagement = new QueryTemplateManagement();
queryTemplateManagement.setName(queryTemplateName);
queryTemplateManagement.setJson(json);
String ret = queryTemplateManagement.createOrUpdate();
return Response.status(Status.CREATED).entity(ret).type(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
.build();
return queryTemplateManagement.createOrUpdate();
}
/*
@ -114,7 +111,7 @@ public class QueryTemplateManager extends BaseRest {
public String read(@PathParam(QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER) String queryTemplateName)
throws NotFoundException, ResourceRegistryException {
logger.info("Requested {} with name", QueryTemplate.NAME, queryTemplateName);
CalledMethodProvider.instance.set("readQueryTemplate");
setAccountingMethod(Method.READ, QueryTemplate.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.setAllMeta(true);
@ -128,7 +125,7 @@ public class QueryTemplateManager extends BaseRest {
/*
* POST /query-templates/{QUERY_TEMPLATE_NAME}
* e.g. GET /query-templates/GetAllEServiceWithState
* e.g. POST /query-templates/GetAllEServiceWithState
*
* params = { "$state" : "ready" }
*
@ -139,7 +136,7 @@ public class QueryTemplateManager extends BaseRest {
public String run(@PathParam(QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER) String queryTemplateName, String params)
throws NotFoundException, InvalidQueryException, ResourceRegistryException {
logger.info("Requested {} with name", QueryTemplate.NAME, queryTemplateName);
CalledMethodProvider.instance.set("readQueryTemplate");
setAccountingMethod(Method.RUN, QueryTemplate.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.checkAllQueryParameters();
@ -161,7 +158,7 @@ public class QueryTemplateManager extends BaseRest {
public Response delete(@PathParam(QueryTemplateManager.QUERY_TEMPLATE_NAME_PATH_PARAMETER) String queryTemplateName)
throws NotFoundException, ResourceRegistryException {
logger.info("Requested to delete {} with name {} ", QueryTemplate.NAME, queryTemplateName);
CalledMethodProvider.instance.set("deleteQueryTemplate");
setAccountingMethod(Method.DELETE, QueryTemplate.NAME);
QueryTemplateManagement queryTemplateManagement = new QueryTemplateManagement();
queryTemplateManagement.setName(queryTemplateName);

View File

@ -15,7 +15,6 @@ import org.gcube.com.fasterxml.jackson.core.JsonProcessingException;
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
import org.gcube.informationsystem.contexts.reference.entities.Context;
import org.gcube.informationsystem.resourceregistry.ResourceInitializer;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
@ -110,7 +109,7 @@ public class SharingManager extends BaseRest {
calledMethod.append("RemoveFromContext");
}
calledMethod.append("NoPropagationConstraint");
CalledMethodProvider.instance.set(calledMethod.toString());
setAccountingMethod(calledMethod.toString());
ObjectMapper objectMapper = new ObjectMapper();
ArrayNode arrayNode = (ArrayNode) objectMapper.readTree(body);
@ -190,7 +189,7 @@ public class SharingManager extends BaseRest {
logger.info("Requested {} {} with UUID {} from {} with UUID {}", dryRun? "a dry run for removing": "to remove", type, instanceId, Context.NAME, contextId);
calledMethod.append("RemoveFromContext");
}
CalledMethodProvider.instance.set(calledMethod.toString());
setAccountingMethod(calledMethod.toString());
ElementManagement<?,?> elementManagement = ElementManagementUtility.getERManagement(type);

View File

@ -14,7 +14,6 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
import org.gcube.informationsystem.resourceregistry.ResourceInitializer;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException;
@ -51,7 +50,7 @@ public class TypeManager extends BaseRest {
public Response create(@PathParam(TypeManager.TYPE_PATH_PARAMETER) String typeName, String json)
throws SchemaException, ResourceRegistryException {
logger.info("Requested {} creation with schema {}", typeName, json);
CalledMethodProvider.instance.set("createType");
setAccountingMethod(Method.CREATE, Type.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.setAllMeta(true);
@ -77,7 +76,7 @@ public class TypeManager extends BaseRest {
@QueryParam(TypePath.POLYMORPHIC_QUERY_PARAMETER) @DefaultValue("false") Boolean polymorphic)
throws SchemaNotFoundException, ResourceRegistryException {
logger.info("Requested Schema for type {}", type);
CalledMethodProvider.instance.set("readType");
setAccountingMethod(Method.READ, Type.NAME);
ServerRequestInfo serverRequestInfo = initRequestInfo();
serverRequestInfo.setAllMeta(true);