Active Query Builder Web API

Client for Java

Download the client for Java


You can download the ready-to-use client for Java using the "Download now" link below or install the package from the public repository. Using the package will let you keep the client up-to-date. Full source code is available at GitHub.

Direct Download

Download Active Query Builder Web API Client for Java:

Download now

Source code on GitHub

Download and review source code of Active Query Builder Web API Client for Java on GitHub

Source on Github
Getting started with the client for Java
Create a new API provider
ActiveQueryBuilderApi api = new ActiveQueryBuilderApi();
Create a new Transform object
Transform transform = new Transform();
transform.setGuid("9dbd355e-360e-430e-9cca-df6dd8b6d8d1"); //Metadata Guid from dashboard
transform.setSql("select id, name from Person"); //Initial sql query
Add totals calculation
Totals max = new Totals();
max.setField("id");
max.setAggregate(Totals.AggregateEnum.MAX);

Totals min = new Totals();
min.setField("id");
min.setAggregate(Totals.AggregateEnum.MIN);

transform.setTotals(Arrays.asList(max, min));
Define pagination
Pagination page = new Pagination();
page.setSkip(2);
page.setTake(3);

transform.setPagination(page);
Setup sorting
Sorting asc = new Sorting();
asc.setField("id");
asc.setOrder(Sorting.OrderEnum.ASC);

Sorting desc = new Sorting();
desc.setField("name");
desc.setOrder(Sorting.OrderEnum.DESC);

transform.setSortings(Arrays.asList(asc, desc));
Apply filters
ConditionGroup filter = new ConditionGroup();

Condition condition = new Condition();
condition.setField("id");
condition.setConditionOperator(Condition.ConditionOperatorEnum.BETWEEN);
condition.setValues(Arrays.asList("1", "5"));

filter.setConditions(Arrays.asList(condition));

transform.setFilter(filter);
Hide some columns
HiddenColumn column = new HiddenColumn();
column.setField("name");

transform.setHiddenColumns(Arrays.asList(column));
Send request to the API
TransformResult result = api.transformSQLPost(transform);
String transformedSql = result.getSql();
Get list of query columns
SqlQuery query = new SqlQuery();
query.setGuid("9dbd355e-360e-430e-9cca-df6dd8b6d8d1"); //Metadata Guid from dashboard
query.setText("select id, name from Person"); //Initial sql query

List<QueryColumn> columns = api.getQueryColumnsPost(query);