Added constraint in query

This commit is contained in:
Luca Frosini 2022-02-24 12:09:42 +01:00
parent ea71d5d8e5
commit c85b66e026
1 changed files with 2 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper; 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.ArrayNode;
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode; import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
import org.gcube.common.authorization.utils.manager.SecretManager;
import org.gcube.common.resources.gcore.GenericResource; import org.gcube.common.resources.gcore.GenericResource;
import org.gcube.common.resources.gcore.ServiceEndpoint; import org.gcube.common.resources.gcore.ServiceEndpoint;
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint; import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
@ -165,6 +166,7 @@ public class GCoreISConfigurationProxy {
*/ */
private List<ServiceEndpoint> getServiceEndpoints(String category, String name) { private List<ServiceEndpoint> getServiceEndpoints(String category, String name) {
SimpleQuery query = queryFor(ServiceEndpoint.class); SimpleQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Scopes/Scope/text() eq '" + SecretManager.instance.get().getContext() + "'");
query.addCondition("$resource/Profile/Category/text() eq '" + category + "'"); query.addCondition("$resource/Profile/Category/text() eq '" + category + "'");
query.addCondition("$resource/Profile/Name/text() eq '" + name + "'"); query.addCondition("$resource/Profile/Name/text() eq '" + name + "'");
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class); DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);