Added possibility to run QueryTemplate with defaults(no provided params)
This commit is contained in:
parent
c6305c9570
commit
34fe3af013
|
@ -263,9 +263,11 @@ public class QueryTemplateManagement extends EntityElementManagement<QueryTempla
|
|||
|
||||
public void setParams(String params) throws ResourceRegistryException {
|
||||
try {
|
||||
if(params!=null && params.compareTo("")!=0) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode jsonNode = objectMapper.readTree(params);
|
||||
setParams(jsonNode);
|
||||
}
|
||||
} catch (ResourceRegistryException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
|
@ -287,9 +289,14 @@ public class QueryTemplateManagement extends EntityElementManagement<QueryTempla
|
|||
try {
|
||||
String read = read();
|
||||
QueryTemplate queryTemplate = ElementMapper.unmarshal(QueryTemplate.class, read);
|
||||
JsonNode jsonNode = queryTemplate.getJsonQuery(params);
|
||||
JsonNode query = null;
|
||||
if(params!=null) {
|
||||
query = queryTemplate.getJsonQuery(params);
|
||||
}else {
|
||||
query = queryTemplate.getJsonQuery();
|
||||
}
|
||||
JsonQuery jsonQuery = new JsonQuery();
|
||||
jsonQuery.setJsonQuery(jsonNode);
|
||||
jsonQuery.setJsonQuery(query);
|
||||
return jsonQuery.query();
|
||||
} catch (ResourceRegistryException e) {
|
||||
throw e;
|
||||
|
|
Loading…
Reference in New Issue