Fixed method signature

This commit is contained in:
Luca Frosini 2022-12-13 11:20:23 +01:00
parent f2b6abb6f0
commit 01dac78793
4 changed files with 18 additions and 13 deletions

View File

@ -2,6 +2,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for Resource Registry Query Template Client
## [v1.0.1-SNAPSHOT]
- Fixed result of run from List<Entity> to List<ERElement>
## [v1.0.0]
- First Release

View File

@ -10,7 +10,7 @@
<groupId>org.gcube.information-system</groupId>
<artifactId>resource-registry-query-template-client</artifactId>
<version>1.0.0</version>
<version>1.0.1-SNAPSHOT</version>
<name>Resource Registry Query Template Client</name>
<description>Resource Registry Query Template Client is a library designed to interact with Resource Registry Query Template APIs</description>

View File

@ -3,7 +3,7 @@ package org.gcube.informationsystem.resourceregistry.queries.templates;
import java.util.List;
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.informationsystem.model.reference.entities.Entity;
import org.gcube.informationsystem.model.reference.ERElement;
import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templates.QueryTemplateAlreadyPresentException;
@ -36,15 +36,15 @@ public interface ResourceRegistryQueryTemplateClient {
public String runGetString(String name) throws QueryTemplateNotFoundException, ResourceRegistryException;
public <E extends Entity> List<E> run(String name) throws QueryTemplateNotFoundException, ResourceRegistryException;
public <E extends ERElement> List<E> run(String name) throws QueryTemplateNotFoundException, ResourceRegistryException;
public <E extends Entity> List<E> run(QueryTemplate queryTemplate) throws QueryTemplateNotFoundException, ResourceRegistryException;
public <E extends ERElement> List<E> run(QueryTemplate queryTemplate) throws QueryTemplateNotFoundException, ResourceRegistryException;
public String run(String name, String params) throws QueryTemplateNotFoundException, ResourceRegistryException;
public <E extends Entity> List<E> run(String name, JsonNode jsonNode) throws QueryTemplateNotFoundException, ResourceRegistryException;
public <E extends ERElement> List<E> run(String name, JsonNode jsonNode) throws QueryTemplateNotFoundException, ResourceRegistryException;
public <E extends Entity> List<E> run(QueryTemplate queryTemplate, JsonNode jsonNode) throws QueryTemplateNotFoundException, ResourceRegistryException;
public <E extends ERElement> List<E> run(QueryTemplate queryTemplate, JsonNode jsonNode) throws QueryTemplateNotFoundException, ResourceRegistryException;
public boolean delete(QueryTemplate queryTemplate) throws QueryTemplateNotFoundException, ResourceRegistryException;

View File

@ -9,7 +9,7 @@ import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.gcube.common.gxhttp.reference.GXConnection;
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
import org.gcube.informationsystem.model.reference.entities.Entity;
import org.gcube.informationsystem.model.reference.ERElement;
import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
@ -210,10 +210,10 @@ public class ResourceRegistryQueryTemplateClientImpl implements ResourceRegistry
}
@Override
public <E extends Entity> List<E> run(String name) throws QueryTemplateNotFoundException, ResourceRegistryException {
public <E extends ERElement> List<E> run(String name) throws QueryTemplateNotFoundException, ResourceRegistryException {
try {
String ret = runGetString(name);
JavaType type = ElementMapper.getObjectMapper().getTypeFactory().constructCollectionType(ArrayList.class, Entity.class);
JavaType type = ElementMapper.getObjectMapper().getTypeFactory().constructCollectionType(ArrayList.class, ERElement.class);
return ElementMapper.getObjectMapper().readValue(ret, type);
} catch(ResourceRegistryException e) {
throw e;
@ -223,7 +223,7 @@ public class ResourceRegistryQueryTemplateClientImpl implements ResourceRegistry
}
@Override
public <E extends Entity> List<E> run(QueryTemplate queryTemplate) throws QueryTemplateNotFoundException, ResourceRegistryException {
public <E extends ERElement> List<E> run(QueryTemplate queryTemplate) throws QueryTemplateNotFoundException, ResourceRegistryException {
return run(queryTemplate.getName());
}
@ -257,11 +257,11 @@ public class ResourceRegistryQueryTemplateClientImpl implements ResourceRegistry
}
@Override
public <E extends Entity> List<E> run(String name, JsonNode jsonNode) throws QueryTemplateNotFoundException, ResourceRegistryException {
public <E extends ERElement> List<E> run(String name, JsonNode jsonNode) throws QueryTemplateNotFoundException, ResourceRegistryException {
try {
ObjectMapper objectMapper = new ObjectMapper();
String ret = run(name, objectMapper.writeValueAsString(jsonNode));
JavaType type = ElementMapper.getObjectMapper().getTypeFactory().constructCollectionType(ArrayList.class, Entity.class);
JavaType type = ElementMapper.getObjectMapper().getTypeFactory().constructCollectionType(ArrayList.class, ERElement.class);
return ElementMapper.getObjectMapper().readValue(ret, type);
} catch(ResourceRegistryException e) {
throw e;
@ -271,7 +271,7 @@ public class ResourceRegistryQueryTemplateClientImpl implements ResourceRegistry
}
@Override
public <E extends Entity> List<E> run(QueryTemplate queryTemplate, JsonNode jsonNode) throws QueryTemplateNotFoundException, ResourceRegistryException {
public <E extends ERElement> List<E> run(QueryTemplate queryTemplate, JsonNode jsonNode) throws QueryTemplateNotFoundException, ResourceRegistryException {
return run(queryTemplate.getName(), jsonNode);
}