Generalised runQueryTempalte function
This commit is contained in:
parent
7d4bb7d70f
commit
c171876186
|
@ -139,19 +139,19 @@ public interface ResourceRegistryClient extends RequestInfo {
|
||||||
public String runQueryTemplateGetString(String name)
|
public String runQueryTemplateGetString(String name)
|
||||||
throws QueryTemplateNotFoundException, ResourceRegistryException;
|
throws QueryTemplateNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public <E extends Entity> List<E> runQueryTemplate(String name)
|
public String runQueryTemplate(String name)
|
||||||
throws QueryTemplateNotFoundException, ResourceRegistryException;
|
throws QueryTemplateNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public <E extends Entity> List<E> runQueryTemplate(QueryTemplate queryTemplate)
|
public String runQueryTemplate(QueryTemplate queryTemplate)
|
||||||
throws QueryTemplateNotFoundException, ResourceRegistryException;
|
throws QueryTemplateNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public String runQueryTemplate(String name, String params)
|
public String runQueryTemplate(String name, String params)
|
||||||
throws QueryTemplateNotFoundException, ResourceRegistryException;
|
throws QueryTemplateNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public <E extends Entity> List<E> runQueryTemplate(String name, JsonNode jsonNode)
|
public String runQueryTemplate(String name, JsonNode jsonNode)
|
||||||
throws QueryTemplateNotFoundException, ResourceRegistryException;
|
throws QueryTemplateNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
public <E extends Entity> List<E> runQueryTemplate(QueryTemplate queryTemplate, JsonNode jsonNode)
|
public String runQueryTemplate(QueryTemplate queryTemplate, JsonNode jsonNode)
|
||||||
throws QueryTemplateNotFoundException, ResourceRegistryException;
|
throws QueryTemplateNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
|
@ -1106,13 +1106,26 @@ public class ResourceRegistryClientImpl extends BaseRequestInfo implements Resou
|
||||||
return runQueryTemplate(name, "");
|
return runQueryTemplate(name, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public <E extends Entity> List<E> runQueryTemplate(String name)
|
||||||
|
// throws QueryTemplateNotFoundException, ResourceRegistryException {
|
||||||
|
// try {
|
||||||
|
// String ret = runQueryTemplateGetString(name);
|
||||||
|
// JavaType type = ElementMapper.getObjectMapper().getTypeFactory().constructCollectionType(ArrayList.class, Entity.class);
|
||||||
|
// return ElementMapper.getObjectMapper().readValue(ret, type);
|
||||||
|
// } catch(ResourceRegistryException e) {
|
||||||
|
// throw e;
|
||||||
|
// } catch(Exception e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <E extends Entity> List<E> runQueryTemplate(String name)
|
public String runQueryTemplate(String name)
|
||||||
throws QueryTemplateNotFoundException, ResourceRegistryException {
|
throws QueryTemplateNotFoundException, ResourceRegistryException {
|
||||||
try {
|
try {
|
||||||
String ret = runQueryTemplateGetString(name);
|
String ret = runQueryTemplateGetString(name);
|
||||||
JavaType type = ElementMapper.getObjectMapper().getTypeFactory().constructCollectionType(ArrayList.class, Entity.class);
|
return ret;
|
||||||
return ElementMapper.getObjectMapper().readValue(ret, type);
|
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
|
@ -1121,7 +1134,7 @@ public class ResourceRegistryClientImpl extends BaseRequestInfo implements Resou
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <E extends Entity> List<E> runQueryTemplate(QueryTemplate queryTemplate)
|
public String runQueryTemplate(QueryTemplate queryTemplate)
|
||||||
throws QueryTemplateNotFoundException, ResourceRegistryException {
|
throws QueryTemplateNotFoundException, ResourceRegistryException {
|
||||||
return runQueryTemplate(queryTemplate.getName());
|
return runQueryTemplate(queryTemplate.getName());
|
||||||
}
|
}
|
||||||
|
@ -1159,7 +1172,7 @@ public class ResourceRegistryClientImpl extends BaseRequestInfo implements Resou
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <E extends Entity> List<E> runQueryTemplate(String name, JsonNode jsonNode)
|
public String runQueryTemplate(String name, JsonNode jsonNode)
|
||||||
throws QueryTemplateNotFoundException, ResourceRegistryException {
|
throws QueryTemplateNotFoundException, ResourceRegistryException {
|
||||||
try {
|
try {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
@ -1174,7 +1187,7 @@ public class ResourceRegistryClientImpl extends BaseRequestInfo implements Resou
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <E extends Entity> List<E> runQueryTemplate(QueryTemplate queryTemplate, JsonNode jsonNode)
|
public String runQueryTemplate(QueryTemplate queryTemplate, JsonNode jsonNode)
|
||||||
throws QueryTemplateNotFoundException, ResourceRegistryException {
|
throws QueryTemplateNotFoundException, ResourceRegistryException {
|
||||||
return runQueryTemplate(queryTemplate.getName(), jsonNode);
|
return runQueryTemplate(queryTemplate.getName(), jsonNode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue