Compare commits

...

9 Commits

27 changed files with 293 additions and 170 deletions

View File

@ -2,7 +2,16 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for Resource Registry Service
## [v4.1.0-SNAPSHOT]
## [v5.0.0-SNAPSHOT]
- Switched to gcube-smartgears-bom 3.0.0
- Fixed bug on JSONQuery for Facets which does not have any properties to match [#24237]
- Fixed bug on JSONQuery for IsRelatedTo relations indicating both source and target resources [#24264]
- Fixed bug on returned boolean values as string [#24240]
- Enabled array properties [#24225]
## [v4.1.0]
- Relation source-target instance types are validated against Relation schema [#7355]
- The instances are validated with the defined schema [#18216]

15
pom.xml
View File

@ -10,7 +10,7 @@
<groupId>org.gcube.information-system</groupId>
<artifactId>resource-registry</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<name>Resource Registry Service</name>
<description>The Resource Registry is a web-service which represent the core component of the gCube Information System</description>
<packaging>war</packaging>
@ -31,7 +31,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-smartgears-bom</artifactId>
<version>2.2.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -40,19 +40,16 @@
<dependencies>
<dependency>
<groupId>org.gcube.information-system</groupId>
<artifactId>resource-registry-api</artifactId>
<scope>provided</scope>
<groupId>org.gcube.core</groupId>
<artifactId>common-smartgears</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.information-system</groupId>
<artifactId>information-system-model</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-utils</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<groupId>org.gcube.information-system</groupId>
<artifactId>resource-registry-api</artifactId>
</dependency>
<dependency>
<groupId>com.orientechnologies</groupId>

View File

@ -5,8 +5,8 @@ import java.util.Map;
import java.util.NoSuchElementException;
import java.util.UUID;
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.common.security.ContextBean;
import org.gcube.common.security.providers.SecretManagerProvider;
import org.gcube.informationsystem.base.reference.IdentifiableElement;
import org.gcube.informationsystem.contexts.reference.entities.Context;
import org.gcube.informationsystem.contexts.reference.relations.IsParentOf;
@ -222,7 +222,7 @@ public class ContextUtility {
private OVertex getContextVertexByFullName(ODatabaseDocument oDatabaseDocument, String fullName) throws ResourceRegistryException {
logger.trace("Going to get {} {} with full name '{}'", Context.NAME, OVertex.class.getSimpleName(), fullName);
ScopeBean scopeBean = new ScopeBean(fullName);
ContextBean scopeBean = new ContextBean(fullName);
String name = scopeBean.name();
// TODO Rewrite better query. This query works because all the scope parts has a different name

View File

@ -20,10 +20,10 @@ 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.com.fasterxml.jackson.databind.node.BooleanNode;
import org.gcube.com.fasterxml.jackson.databind.node.JsonNodeType;
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
import org.gcube.com.fasterxml.jackson.databind.node.TextNode;
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.IdentifiableElement;
@ -50,6 +50,7 @@ import org.gcube.informationsystem.resourceregistry.utils.Utility;
import org.gcube.informationsystem.types.reference.Type;
import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.smartgears.utils.InnerMethodName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -625,9 +626,9 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
internalUpdate();
} catch(NotFoundException e) {
setAsEntryPoint();
String calledMethod = CalledMethodProvider.instance.get();
String calledMethod = InnerMethodName.instance.get();
calledMethod = calledMethod.replace("update", "create");
CalledMethodProvider.instance.set(calledMethod);
InnerMethodName.instance.set(calledMethod);
internalCreate();
}
@ -774,7 +775,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
}
public void delete() throws NotFoundException, AvailableInAnotherContextException, SchemaViolationException, ResourceRegistryException {
logger.debug("Going to delete {} with UUID {}", accessType.getName(), uuid);
logger.trace("Going to delete {} instance with UUID {}", accessType.getName(), uuid);
ODatabaseDocument current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal();
try {
// oDatabaseDocument = ContextUtility.getAdminSecurityContext().getDatabaseDocument(PermissionMode.WRITER);
@ -815,7 +816,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
public Set<String> getContextsSet() throws NotFoundException, ContextException, ResourceRegistryException {
logger.debug("Going to get contexts for {} with UUID", typeName, uuid);
logger.trace("Going to get contexts for {} instance with UUID {}", typeName, uuid);
ODatabaseDocument current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal();
try {
AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext();
@ -893,7 +894,16 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
return PropertyElementManagement.getPropertyDocument(value);
case ARRAY:
break;
/*
* Due to bug https://github.com/orientechnologies/orientdb/issues/7354
* we should not support ArrayList
*/
List<Object> list = new ArrayList<>();
ArrayNode arrayNode = (ArrayNode) value;
for(JsonNode node : arrayNode) {
list.add(getObjectFromJsonNode(node));
}
return list;
case BINARY:
break;
@ -1075,7 +1085,13 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
if(object != null) {
if(object instanceof ODocument) {
element.setProperty(key, object, OType.EMBEDDED);
}else {
/*
* Due to bug https://github.com/orientechnologies/orientdb/issues/7354
* we should not support ArrayList
*/
} else if(object instanceof List){
element.setProperty(key, object, OType.EMBEDDEDLIST);
} else {
element.setProperty(key, object);
}
}
@ -1194,6 +1210,10 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
return objectNode;
}
if(object instanceof Boolean) {
return BooleanNode.valueOf((Boolean) object);
}
return new TextNode(object.toString());
} catch(Exception e) {

View File

@ -120,7 +120,10 @@ public class JsonQuery {
Map<String, Object> map = new HashMap<>();
map.put("limit", JsonQuery.UNBOUNDED_LIMIT);
OResultSet resultSet = oDatabaseDocument.query(stringBuffer.toString(), map);
String query = stringBuffer.toString();
logger.trace("Going to execute the following query:\n{} \n from the JSONQuery\n{}", query, objectMapper.writeValueAsString(jsonQuery));
OResultSet resultSet = oDatabaseDocument.query(query, map);
ArrayNode arrayNode = objectMapper.createArrayNode();

View File

@ -24,6 +24,8 @@ public class JsonQueryFacet extends JsonQueryEntity {
public StringBuffer analize(StringBuffer stringBuffer) throws SchemaException, ResourceRegistryException {
StringBuffer newBuffer = new StringBuffer();
int size = jsonNode.size();
boolean entry = entryPoint;
if(jsonNode.has(_IN)) {
if(!entryPoint) {
@ -35,9 +37,14 @@ public class JsonQueryFacet extends JsonQueryEntity {
jsonQueryConsistsOf.setDirection(Direction.OUT);
stringBuffer = jsonQueryConsistsOf.analize(stringBuffer);
entry = false;
/* Need to substract 1 from size otherwise
* it add WHERE at the end because _in
* is not a property to be used for a WHERE compare
*/
--size;
}
int size = jsonNode.size();
newBuffer.append("SELECT FROM ");
if(!entry) {

View File

@ -3,7 +3,7 @@ package org.gcube.informationsystem.resourceregistry.queries.json.base.relations
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.base.reference.Direction;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException;
@ -32,7 +32,19 @@ public class JsonQueryIsRelatedTo extends JsonQueryRelation {
StringBuffer buffer = new StringBuffer();
int size = jsonNode.size();
if(size > 2) {
// Remove @class from size
--size;
if(jsonNode.has(IsRelatedTo.SOURCE_PROPERTY)) {
--size;
}
if(jsonNode.has(IsRelatedTo.TARGET_PROPERTY)) {
--size;
}
if(size > 0) {
buffer.append("SELECT FROM ");
if(entryPoint) {
buffer.append(type);
@ -60,8 +72,8 @@ public class JsonQueryIsRelatedTo extends JsonQueryRelation {
stringBuffer = buffer;
// Size 2 means that only '@class' and 'target'/'source' properties are present
if(size > 2) {
// Size 0 means that only '@class' and 'target'/'source' properties are present
if(size > 0) {
if(!entryPoint) {
stringBuffer.append(" )"); // Close ) SELECT
}
@ -75,8 +87,8 @@ public class JsonQueryIsRelatedTo extends JsonQueryRelation {
@Override
public StringBuffer analize(StringBuffer stringBuffer) throws SchemaException, ResourceRegistryException {
JsonNode sourceJsonNode = jsonNode.get(ConsistsOf.SOURCE_PROPERTY);
JsonNode targetJsonNode = jsonNode.get(ConsistsOf.TARGET_PROPERTY);
JsonNode sourceJsonNode = jsonNode.get(IsRelatedTo.SOURCE_PROPERTY);
JsonNode targetJsonNode = jsonNode.get(IsRelatedTo.TARGET_PROPERTY);
JsonNode resourceJsonNode = null;
@ -96,11 +108,13 @@ public class JsonQueryIsRelatedTo extends JsonQueryRelation {
stringBuffer = jsonQueryResource.analize(stringBuffer);
StringBuffer buffer = new StringBuffer();
buffer.append("TRAVERSE ");
buffer.append(direction.opposite().name().toLowerCase());
buffer.append("V(\"");
buffer.append(requestedResourceType);
buffer.append("\") FROM ( ");
if(requestedResourceType!=null) {
buffer.append("TRAVERSE ");
buffer.append(direction.opposite().name().toLowerCase());
buffer.append("V(\"");
buffer.append(requestedResourceType);
buffer.append("\") FROM ( ");
}
buffer.append("TRAVERSE ");
buffer.append(direction.name().toLowerCase());
buffer.append("E(\"");
@ -108,13 +122,29 @@ public class JsonQueryIsRelatedTo extends JsonQueryRelation {
buffer.append("\") FROM ( ");
buffer.append(stringBuffer);
buffer.append(")");
buffer.append(")");
if(requestedResourceType!=null) {
buffer.append(")");
}
stringBuffer = buffer;
if(sourceJsonNode!=null && targetJsonNode!=null) {
// Target has still to be analised
jsonQueryResource = new JsonQueryResource(targetJsonNode);
jsonQueryResource.setDirection(Direction.IN);
jsonQueryResource.setEntryPoint(false);
stringBuffer = jsonQueryResource.analize(stringBuffer);
boolean entryPointOldValue = entryPoint;
// It is no more and entry point for the function traverseThisEdge
entryPoint = false;
stringBuffer = traverseThisEdge(stringBuffer);
// Restoring entryPoint indication
entryPoint = entryPointOldValue;
}
return stringBuffer;
}
}

View File

@ -19,7 +19,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.resourceregistry.ResourceInitializer;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
@ -43,6 +42,7 @@ import org.gcube.informationsystem.resourceregistry.queries.json.JsonQuery;
import org.gcube.informationsystem.resourceregistry.types.TypeManagement;
import org.gcube.informationsystem.types.TypeMapper;
import org.gcube.informationsystem.types.reference.Type;
import org.gcube.smartgears.utils.InnerMethodName;
import com.orientechnologies.orient.core.record.ODirection;
@ -68,7 +68,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");
InnerMethodName.instance.set("listContexts");
ContextManagement contextManagement = new ContextManagement();
return contextManagement.all(false);
@ -87,7 +87,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");
InnerMethodName.instance.set("readContext");
ContextManagement contextManagement = new ContextManagement();
contextManagement.setUUID(UUID.fromString(uuid));
@ -105,7 +105,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");
InnerMethodName.instance.set("readType");
TypeManagement typeManagement = new TypeManagement();
typeManagement.setTypeName(type);
@ -129,7 +129,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");
InnerMethodName.instance.set("listInstances");
checkHierarchicalMode();
checkIncludeInstancesContexts();
@ -149,7 +149,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");
InnerMethodName.instance.set("existInstance");
checkHierarchicalMode();
checkIncludeInstancesContexts();
@ -186,7 +186,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");
InnerMethodName.instance.set("readInstance");
checkHierarchicalMode();
checkIncludeInstancesContexts();
@ -212,7 +212,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");
InnerMethodName.instance.set("getInstanceContexts");
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(type);
erManagement.setUUID(UUID.fromString(instanceId));
@ -243,7 +243,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");
InnerMethodName.instance.set("graphQuery");
checkHierarchicalMode();
checkIncludeInstancesContexts();
@ -297,7 +297,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");
InnerMethodName.instance.set("jsonQuery");
checkHierarchicalMode();
checkIncludeInstancesContexts();
@ -348,7 +348,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");
InnerMethodName.instance.set("query");
checkHierarchicalMode();
checkIncludeInstancesContexts();

View File

@ -13,7 +13,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.contexts.reference.entities.Context;
import org.gcube.informationsystem.resourceregistry.ResourceInitializer;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
@ -21,6 +20,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.Cont
import org.gcube.informationsystem.resourceregistry.api.rest.ContextPath;
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
import org.gcube.informationsystem.resourceregistry.contexts.entities.ContextManagement;
import org.gcube.smartgears.utils.InnerMethodName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -51,7 +51,7 @@ public class ContextManager {
@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");
InnerMethodName.instance.set("listContexts");
ContextManagement contextManagement = new ContextManagement();
return contextManagement.all(false);
@ -72,7 +72,7 @@ public class ContextManager {
uuid = ContextUtility.getCurrentSecurityContext().getUUID().toString();
}
logger.info("Requested to read {} with id {} ", Context.NAME, uuid);
CalledMethodProvider.instance.set("readContext");
InnerMethodName.instance.set("readContext");
ContextManagement contextManagement = new ContextManagement();
contextManagement.setUUID(UUID.fromString(uuid));
@ -93,7 +93,7 @@ public class ContextManager {
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");
InnerMethodName.instance.set("updateContext");
ContextManagement contextManagement = new ContextManagement();
contextManagement.setUUID(UUID.fromString(uuid));
@ -111,7 +111,7 @@ public class ContextManager {
public Response delete(@PathParam(ContextManager.CONTEXT_UUID_PATH_PARAMETER) String uuid)
throws ContextNotFoundException, ResourceRegistryException {
logger.info("Requested to delete {} with id {} ", Context.NAME, uuid);
CalledMethodProvider.instance.set("deleteContext");
InnerMethodName.instance.set("deleteContext");
ContextManagement contextManagement = new ContextManagement();
contextManagement.setUUID(UUID.fromString(uuid));

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;
@ -27,6 +26,7 @@ import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath;
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.smartgears.utils.InnerMethodName;
/**
* @author Luca Frosini (ISTI - CNR)
@ -53,7 +53,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");
InnerMethodName.instance.set("listInstances");
checkHierarchicalMode();
checkIncludeInstancesContexts();
@ -74,7 +74,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");
InnerMethodName.instance.set("existInstance");
checkHierarchicalMode();
checkIncludeInstancesContexts();
@ -112,7 +112,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");
InnerMethodName.instance.set("readInstance");
checkHierarchicalMode();
checkIncludeInstancesContexts();
@ -138,7 +138,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");
InnerMethodName.instance.set("updateInstance");
@SuppressWarnings("rawtypes")
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
@ -158,7 +158,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");
InnerMethodName.instance.set("deleteInstance");
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(type);
erManagement.setUUID(UUID.fromString(uuid));
@ -185,7 +185,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");
InnerMethodName.instance.set("getInstanceContexts");
@SuppressWarnings("rawtypes")
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);

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;
@ -20,6 +19,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegis
import org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException;
import org.gcube.informationsystem.resourceregistry.api.rest.QueryTemplatePath;
import org.gcube.informationsystem.resourceregistry.queries.templates.QueryTemplateManagement;
import org.gcube.smartgears.utils.InnerMethodName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -41,7 +41,7 @@ public class QueryTemplateManager {
@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");
InnerMethodName.instance.set("listQueryTemplates");
QueryTemplateManagement queryTemplateManagement = new QueryTemplateManagement();
return queryTemplateManagement.all(false);
@ -84,7 +84,7 @@ public class QueryTemplateManager {
public Response 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");
InnerMethodName.instance.set("createQueryTemplate");
QueryTemplateManagement queryTemplateManagement = new QueryTemplateManagement();
queryTemplateManagement.setName(queryTemplateName);
@ -104,7 +104,7 @@ public class QueryTemplateManager {
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");
InnerMethodName.instance.set("readQueryTemplate");
QueryTemplateManagement queryTemplateManagement = new QueryTemplateManagement();
queryTemplateManagement.setName(queryTemplateName);
@ -125,7 +125,7 @@ public class QueryTemplateManager {
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");
InnerMethodName.instance.set("readQueryTemplate");
QueryTemplateManagement queryTemplateManagement = new QueryTemplateManagement();
queryTemplateManagement.setName(queryTemplateName);
@ -144,7 +144,7 @@ public class QueryTemplateManager {
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");
InnerMethodName.instance.set("deleteQueryTemplate");
QueryTemplateManagement queryTemplateManagement = new QueryTemplateManagement();
queryTemplateManagement.setName(queryTemplateName);

View File

@ -9,13 +9,6 @@ import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.container.PreMatching;
import javax.ws.rs.ext.Provider;
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.authorization.utils.manager.SecretManager;
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
import org.gcube.common.authorization.utils.secret.GCubeSecret;
import org.gcube.common.authorization.utils.secret.JWTSecret;
import org.gcube.common.authorization.utils.secret.Secret;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -31,31 +24,12 @@ public class RequestFilter implements ContainerRequestFilter, ContainerResponseF
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
logger.trace("PreMatching RequestFilter");
SecretManagerProvider.instance.reset();
SecretManager secretManager = new SecretManager();
String token = AccessTokenProvider.instance.get();
if(token!=null) {
Secret secret = new JWTSecret(token);
secretManager.addSecret(secret);
}
token = SecurityTokenProvider.instance.get();
if(token!=null) {
Secret secret = new GCubeSecret(token);
secretManager.addSecret(secret);
}
SecretManagerProvider.instance.set(secretManager);
}
@Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
throws IOException {
logger.trace("ResponseFilter");
SecretManagerProvider.instance.reset();
}
}

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.base.reference.Element;
import org.gcube.informationsystem.base.reference.IdentifiableElement;
import org.gcube.informationsystem.contexts.reference.entities.Context;
@ -31,6 +30,7 @@ import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.instances.model.ERManagement;
import org.gcube.smartgears.utils.InnerMethodName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -113,7 +113,7 @@ public class SharingManager {
calledMethod.append("RemoveFromContext");
}
calledMethod.append("NoPropagationConstraint");
CalledMethodProvider.instance.set(calledMethod.toString());
InnerMethodName.instance.set(calledMethod.toString());
ObjectMapper objectMapper = new ObjectMapper();
ArrayNode arrayNode = (ArrayNode) objectMapper.readTree(body);
@ -191,7 +191,7 @@ public class SharingManager {
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());
InnerMethodName.instance.set(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;
@ -24,6 +23,7 @@ import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
import org.gcube.informationsystem.resourceregistry.types.TypeManagement;
import org.gcube.informationsystem.types.TypeMapper;
import org.gcube.informationsystem.types.reference.Type;
import org.gcube.smartgears.utils.InnerMethodName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -56,7 +56,7 @@ public class TypeManager {
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");
InnerMethodName.instance.set("createType");
TypeManagement schemaManagement = new TypeManagement();
schemaManagement.setTypeName(typeName);
@ -78,7 +78,7 @@ public class TypeManager {
@QueryParam(TypePath.POLYMORPHIC_QUERY_PARAMETER) @DefaultValue("false") Boolean polymorphic)
throws SchemaNotFoundException, ResourceRegistryException {
logger.info("Requested Schema for type {}", type);
CalledMethodProvider.instance.set("readType");
InnerMethodName.instance.set("readType");
TypeManagement schemaManagement = new TypeManagement();
schemaManagement.setTypeName(type);

View File

@ -9,7 +9,7 @@ import java.util.UUID;
import org.gcube.com.fasterxml.jackson.core.JsonParseException;
import org.gcube.com.fasterxml.jackson.databind.JsonMappingException;
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
import org.gcube.common.security.providers.SecretManagerProvider;
import org.gcube.informationsystem.base.reference.IdentifiableElement;
import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
@ -31,7 +31,7 @@ public class HeaderUtility {
public static String getUser() {
String user = Header.UNKNOWN_USER;
try {
user = SecretManagerProvider.instance.get().getUser().getUsername();
user = SecretManagerProvider.instance.get().getOwner().getId();
} catch(Exception e) {
logger.error("Unable to retrieve user. {} will be used", user);
}

View File

@ -7,25 +7,18 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.gcube.common.authorization.utils.manager.SecretManager;
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
import org.gcube.common.authorization.utils.secret.Secret;
import org.gcube.common.authorization.utils.secret.SecretUtility;
import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.common.security.providers.SecretManagerProvider;
import org.gcube.common.security.secrets.CredentialSecret;
import org.gcube.common.security.secrets.Secret;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class ContextTest {
private static final Logger logger = LoggerFactory.getLogger(ContextTest.class);
protected static Properties properties;
protected static final String PROPERTIES_FILENAME = "token.properties";
protected static final String CONFIG_INI_FILENAME = "config.ini";
public static final String PARENT_DEFAULT_TEST_SCOPE;
public static final String DEFAULT_TEST_SCOPE;
@ -36,18 +29,16 @@ public class ContextTest {
public static final String NEXTNEXT;
public static final String DEVSEC;
public static final String DEVVRE;
protected static final Properties properties;
protected static final String CLIENT_ID_PROPERTY_KEY = "client_id";
protected static final String CLIENT_SECRET_PROPERTY_KEY = "client_secret";
protected static final String clientID;
protected static final String clientSecret;
static {
properties = new Properties();
InputStream input = ContextTest.class.getClassLoader().getResourceAsStream(PROPERTIES_FILENAME);
try {
// load the properties file
properties.load(input);
} catch(IOException e) {
throw new RuntimeException(e);
}
GCUBE = "/gcube";
DEVNEXT = GCUBE + "/devNext";
NEXTNEXT = DEVNEXT + "/NextNext";
@ -58,44 +49,35 @@ public class ContextTest {
DEFAULT_TEST_SCOPE = DEVNEXT;
ALTERNATIVE_TEST_SCOPE = NEXTNEXT;
properties = new Properties();
InputStream input = ContextTest.class.getClassLoader().getResourceAsStream(CONFIG_INI_FILENAME);
try {
// load the properties file
properties.load(input);
clientID = properties.getProperty(CLIENT_ID_PROPERTY_KEY);
clientSecret = properties.getProperty(CLIENT_SECRET_PROPERTY_KEY);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static void set(Secret secret) throws Exception {
SecretManagerProvider.instance.reset();
SecretManager secretManager = new SecretManager();
secretManager.addSecret(secret);
SecretManagerProvider.instance.set(secretManager);
SecretManagerProvider.instance.get().set();
SecretManagerProvider.instance.set(secret);
}
public static void setContext(String token) throws Exception {
Secret secret = getSecret(token);
set(secret);
}
public static void setContextByName(String fullContextName) throws Exception {
Secret secret = getSecretByContextName(fullContextName);
set(secret);
}
private static Secret getSecret(String token) throws Exception {
Secret secret = SecretUtility.getSecretByTokenString(token);
return secret;
}
private static Secret getSecretByContextName(String fullContextName) throws Exception {
String token = ContextTest.properties.getProperty(fullContextName);
return getSecret(token);
}
public static String getUser() {
String user = Header.UNKNOWN_USER;
try {
user = SecretManagerProvider.instance.get().getUser().getUsername();
} catch(Exception e) {
logger.error("Unable to retrieve user. {} will be used", user);
}
return user;
CredentialSecret credentialSecret = new CredentialSecret(clientID, clientSecret, fullContextName);
return credentialSecret;
}
@BeforeClass

View File

@ -12,6 +12,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.gcube.common.security.providers.SecretManagerProvider;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.IdentifiableElement;
import org.gcube.informationsystem.model.impl.properties.EncryptedImpl;
@ -94,23 +95,23 @@ public class ERManagementTest extends ContextTest {
public static final String VERSION = "1.0.0";
public static final String NEW_VERSION = "2.0.0";
@Before
@After
public void cleanInstances() throws Exception {
// Clean the environment first to avoid error if a previous tests fails without cleaning the env
ResourceManagement rm = (ResourceManagement) ElementManagementUtility.getERManagement(Resource.NAME);
String all = rm.all(true);
List<Resource> allResources = ElementMapper.unmarshalList(Resource.class, all);
for(Resource r : allResources) {
try {
ERManagementTest.deleteResource(r);
}catch (ResourceNotFoundException e) {
// A resource could be already deleted deleting another resource giving the propagation constraint
}catch (ODatabaseException e) {
// could occur
}
}
}
// @Before
// @After
// public void cleanInstances() throws Exception {
// // Clean the environment first to avoid error if a previous tests fails without cleaning the env
// ResourceManagement rm = (ResourceManagement) ElementManagementUtility.getERManagement(Resource.NAME);
// String all = rm.all(true);
// List<Resource> allResources = ElementMapper.unmarshalList(Resource.class, all);
// for(Resource r : allResources) {
// try {
// ERManagementTest.deleteResource(r);
// }catch (ResourceNotFoundException e) {
// // A resource could be already deleted deleting another resource giving the propagation constraint
// }catch (ODatabaseException e) {
// // could occur
// }
// }
// }
public static SoftwareFacet getSoftwareFacet() {
@ -524,7 +525,7 @@ public class ERManagementTest extends ContextTest {
Assert.assertTrue(((String) updatedCpuFacet.getAdditionalProperty(additionPropertyKey))
.compareTo((String) readCpuFacet.getAdditionalProperty(additionPropertyKey)) == 0);
Assert.assertTrue(uuid.compareTo(updatedCpuFacet.getHeader().getUUID()) == 0);
String user = ContextTest.getUser();
String user = SecretManagerProvider.instance.get().getOwner().getId();
Assert.assertTrue(updatedCpuFacet.getHeader().getLastUpdateBy().compareTo(user) == 0);
facetManagement = new FacetManagement();

View File

@ -9,7 +9,7 @@ import java.util.TreeSet;
import java.util.UUID;
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
import org.gcube.common.security.providers.SecretManagerProvider;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.contexts.reference.entities.Context;
import org.gcube.informationsystem.model.reference.entities.Facet;

View File

@ -3,6 +3,7 @@ package org.gcube.informationsystem.resourceregistry.queries;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FilenameFilter;
import java.net.URL;
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
@ -34,8 +35,16 @@ public class JsonQueryTest extends ContextTest {
File queriesDirectory = getQueriesDirectory();
for(int i=1; i<7; i++) {
File jsonQueryFile = new File(queriesDirectory, "query" + i + ".json");
FilenameFilter filenameFilter = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".json");
}
};
for(File jsonQueryFile : queriesDirectory.listFiles(filenameFilter)) {
logger.info("Going to read JSON query frtm file {}", jsonQueryFile.getAbsolutePath());
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.readTree(jsonQueryFile);
logger.info("Going to test the following JSON query {}", jsonNode.toString());
@ -47,7 +56,7 @@ public class JsonQueryTest extends ContextTest {
logger.info("Created Query from JSON: {}", createdStringBuffer.toString());
StringBuffer expectedStringBuffer = new StringBuffer();
File expectedQueryFile = new File(queriesDirectory, "query" + i + ".query");
File expectedQueryFile = new File(queriesDirectory, jsonQueryFile.getName().replace("json", "query"));
try(BufferedReader br = new BufferedReader(new FileReader(expectedQueryFile))) {
for(String line; (line = br.readLine()) != null; ) {
expectedStringBuffer.append(line);
@ -66,7 +75,7 @@ public class JsonQueryTest extends ContextTest {
@Test
public void testSingleCreateQuery() throws Exception {
File queriesDirectory = getQueriesDirectory();
File jsonQueryFile = new File(queriesDirectory, "query5.json");
File jsonQueryFile = new File(queriesDirectory, "query9.json");
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.readTree(jsonQueryFile);
logger.info("Going to test the following JSON query {}", jsonNode.toString());

View File

@ -10,6 +10,7 @@ import org.gcube.com.fasterxml.jackson.databind.JavaType;
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
import org.gcube.common.security.providers.SecretManagerProvider;
import org.gcube.informationsystem.base.reference.IdentifiableElement;
import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.queries.templates.impl.entities.QueryTemplateImpl;
@ -44,7 +45,7 @@ public class QueryTemplateManagementTest extends ContextTest {
Assert.assertTrue(gotHeader != null);
Assert.assertTrue(gotHeader.getUUID() != null);
String user = ContextTest.getUser();
String user = SecretManagerProvider.instance.get().getOwner().getId();
Assert.assertTrue(gotHeader.getLastUpdateBy().compareTo(user) == 0);
if(previousHeader != null) {

View File

@ -1,3 +1,4 @@
/*.properties*
/*.gcubekey
/*.key
/*.key
/config.ini

View File

@ -0,0 +1,21 @@
{
"@class": "StateFacet",
"_in": {
"@class": "ConsistsOf",
"source" : {
"@class" : "EService",
"header": {
"$or": [
{"$and": {
"uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925",
"createdBy": {"$ne": "luca.frosini"}
}},
{"$and": {
"uuid" : "0255b7ec-e3da-4071-b456-9a2907ece1db",
"createdBy": "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080"
}}
]
}
}
}
}

View File

@ -0,0 +1 @@
SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM ( SELECT FROM EService) WHERE ((header.uuid = "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925" AND header.createdBy <> "luca.frosini") OR (header.uuid = "0255b7ec-e3da-4071-b456-9a2907ece1db" AND header.createdBy = "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080")))))

View File

@ -0,0 +1,29 @@
{
"@class": "CallsFor",
"source": {
"@class": "EService",
"consistsOf": [
{
"@class": "IsIdentifiedBy",
"target": {
"@class": "SoftwareFacet",
"group": "org.gcube.data-catalogue",
"name": "gcat"
}
}
]
},
"target":{
"@class": "VirtualService",
"consistsOf": [
{
"@class": "IsIdentifiedBy",
"target": {
"@class": "SoftwareFacet",
"group": "org.gcube.data-catalogue",
"name": "catalogue-virtual-service"
}
}
]
}
}

View File

@ -0,0 +1 @@
TRAVERSE inE("CallsFor") FROM ( TRAVERSE outV("VirtualService") FROM ( TRAVERSE inE("IsIdentifiedBy") FROM ( SELECT FROM ( TRAVERSE inV("SoftwareFacet") FROM ( TRAVERSE outE("IsIdentifiedBy") FROM ( TRAVERSE inV("VirtualService") FROM ( TRAVERSE outE("CallsFor") FROM ( TRAVERSE outV("EService") FROM ( TRAVERSE inE("IsIdentifiedBy") FROM ( SELECT FROM ( TRAVERSE inV("SoftwareFacet") FROM ( TRAVERSE outE("IsIdentifiedBy") FROM ( TRAVERSE outV("EService") FROM ( SELECT FROM CallsFor)))) WHERE group = "org.gcube.data-catalogue" AND name = "gcat"))))))) WHERE group = "org.gcube.data-catalogue" AND name = "catalogue-virtual-service")))

View File

@ -0,0 +1,36 @@
{
"@class": "SimpleFacet",
"_in": {
"@class": "ConsistsOf",
"source": {
"@class": "Configuration",
"consistsOf": [
{
"@class": "IsIdentifiedBy",
"target": {
"@class": "IdentifierFacet",
"value": "gcat-configuration"
}
}
],
"isRelatedTo": [
{
"@class": "IsCustomizedBy",
"source": {
"@class": "VirtualService",
"consistsOf": [
{
"@class": "IsIdentifiedBy",
"target": {
"@class": "SoftwareFacet",
"group": "org.gcube.data-catalogue",
"name": "catalogue-virtual-service"
}
}
]
}
}
]
}
}
}

View File

@ -0,0 +1 @@
SELECT FROM ( TRAVERSE inV("SimpleFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE outV("Configuration") FROM ( TRAVERSE inE("IsIdentifiedBy") FROM ( SELECT FROM ( TRAVERSE inV("IdentifierFacet") FROM ( TRAVERSE outE("IsIdentifiedBy") FROM ( TRAVERSE inV("Configuration") FROM ( TRAVERSE outE("IsCustomizedBy") FROM ( TRAVERSE outV("VirtualService") FROM ( TRAVERSE inE("IsIdentifiedBy") FROM ( SELECT FROM ( TRAVERSE inV("SoftwareFacet") FROM ( TRAVERSE outE("IsIdentifiedBy") FROM ( TRAVERSE outV("VirtualService") FROM ( SELECT FROM IsCustomizedBy)))) WHERE group = "org.gcube.data-catalogue" AND name = "catalogue-virtual-service"))))))) WHERE value = "gcat-configuration")))))