use of org.kie.server.api.model.definition.QueryDefinitionList in project droolsjbpm-integration by kiegroup.
the class QueryServicesClientImpl method getQueries.
@Override
public List<QueryDefinition> getQueries(Integer page, Integer pageSize) {
QueryDefinitionList result = null;
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
String queryString = getPagingQueryString("", page, pageSize);
result = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), QUERY_DEF_URI, valuesMap) + queryString, QueryDefinitionList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("QueryDataService", "getQueries", new Object[] { page, pageSize })));
ServiceResponse<QueryDefinitionList> response = (ServiceResponse<QueryDefinitionList>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM").getResponses().get(0);
throwExceptionOnFailure(response);
if (shouldReturnWithNullResponse(response)) {
return null;
}
result = response.getResult();
}
if (result != null && result.getQueries() != null) {
return Arrays.asList(result.getQueries());
}
return Collections.emptyList();
}
use of org.kie.server.api.model.definition.QueryDefinitionList in project droolsjbpm-integration by kiegroup.
the class QueryDataResource method getQueries.
@ApiOperation(value = "Returns all custom query definitions.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 200, response = QueryDefinitionList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = QUERY_DEF_LIST_RESPONSE_JSON) })) })
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getQueries(@Context HttpHeaders headers, @ApiParam(value = "optional pagination - at which page to start, defaults to 0 (meaning first)", required = false) @QueryParam("page") @DefaultValue("0") Integer page, @ApiParam(value = "optional pagination - size of the result, defaults to 10", required = false) @QueryParam("pageSize") @DefaultValue("10") Integer pageSize) {
// no container id available so only used to transfer conversation id if
// given by client
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
QueryDefinitionList result = queryDataServiceBase.getQueries(page, pageSize);
logger.debug("Returning result of get queries definition: {}", result);
return createCorrectVariant(result, headers, Response.Status.OK, conversationIdHeader);
}
Aggregations