Interface IQueryExecutor<V>
-
- Type Parameters:
V
- the business object class
- All Known Subinterfaces:
ICaseQueryExecutor
,ITaskQueryExecutor
,IUserQueryExecutor
public interface IQueryExecutor<V>
Executes a business query queries and provides different types of results (business object, result sets, count).- Since:
- 11.1.2012
- API:
- This is a public API.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getCount(Query<V> query)
Counts the number of rows or business objects that matches the query.V
getFirstResult(Query<V> query)
Gets the first business objects that matches the givenquery
.Object
getFirstValue(Query<V> query)
Gets the value of the first column and first record that matches the givenquery
.Recordset
getRecordset(Query<V> query)
Gets aRecordset
with all records that matches the givenquery
.Recordset
getRecordset(Query<V> query, int startIndex, int count)
Gets aRecordset
with the records that matches the givenquery
.List<V>
getResults(Query<V> query)
Gets all business objects that matches the givenquery
.List<V>
getResults(Query<V> query, int startIndex, int count)
Gets all business objects that matches the givenquery
.IPagedResult<V>
getResultsPaged(Query<V> query)
Gets the results page wise.IPagedResult<V>
getResultsPaged(Query<V> query, int pageSize)
Gets the results page wise.
-
-
-
Method Detail
-
getResults
List<V> getResults(Query<V> query)
Gets all business objects that matches the given
query
.WARNING: This methods loads the whole resulting data set into memory.
This can cause out of memory exceptions and bad performance of the whole engine.
Only use this method if you are sure that the resulting data set is small. Prefer usinggetResults(Query, int, int)
,getResultsPaged(Query)
This method considers the following parts of the
query
:- The where clauses (used to filter the business objects)
- The orderBy clauses (used to sort the resulting list)
query
:- The groupBy clauses
- The aggregation (count, avg, min, max, sum) clauses
- Parameters:
query
-- Returns:
- list of matching business objects
- See Also:
getResults(Query, int, int)
,getResultsPaged(Query)
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
getResults
List<V> getResults(Query<V> query, int startIndex, int count)
Gets all business objects that matches the given
query
.This method considers the following parts of the
query
:- The where clauses (used to filter the business objects)
- The orderBy clauses (used to sort the resulting list)
query
:- The groupBy clauses
- The aggregation (count, avg, min, max, sum) clauses
The parameters
startIndex
andcount
can be used to limit the number of objects that are returned.- Parameters:
query
-startIndex
- 0..n. The index of the first record is 0.count
- 0..n. Use -1 to return all beginning from the startIndex- Returns:
- list of matching business objects
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
getResultsPaged
IPagedResult<V> getResultsPaged(Query<V> query)
Gets the results page wise.You can use this method in a for each loop to iterate over the results:
for (V businessObject : executor.getResultsPaged(query)) { System.out.println(businessObject); } *
You can use it to display the results in paged table on the UI:
public class MyLazyDataModel extends LazyDataModel<Car> { @ Override public List<Car> load(int first, int pageSize, Map<String, SortMeta> sortMeta, Map<String, FilterMeta> filterMeta) { return executor.getResultsPaged(query).window(first, pageSize); } }
This method considers the following parts of the
query
:- The where clauses (used to filter the business objects)
- The orderBy clauses (used to sort the resulting list)
query
:- The groupBy clauses
- The aggregation (count, avg, min, max, sum) clauses
You can use this method to iterate over the results by reading and loading only part of them into memory at once. This allows you to iterate over huge data sets without loading all data into memory.
This method uses a default, system defined page size (1000) which does not harm memory and provides still good performance.
- Returns:
- paged result
- Since:
- 8.0.3
- See Also:
getResultsPaged(Query, int)
,getResults(Query, int, int)
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
getResultsPaged
IPagedResult<V> getResultsPaged(Query<V> query, int pageSize)
Gets the results page wise.You can use this method in a for each loop to iterate over the results:
for (V businessObject : executor.getResultsPaged(query, 100)) { System.out.println(businessObject); } *
You can use it to display the results in paged table on the UI:
public class MyLazyDataModel extends LazyDataModel<Car> { @ Override public List<Car> load(int first, int pageSize, Map<String, SortMeta> sortMeta, Map<String, FilterMeta> filterMeta) { return executor.getResultsPaged(query, pageSize).window(first, pageSize); } }
This method considers the following parts of the
query
:- The where clauses (used to filter the business objects)
- The orderBy clauses (used to sort the resulting list)
query
:- The groupBy clauses
- The aggregation (count, avg, min, max, sum) clauses
You can use this method to iterate over the results by reading and loading only part of them into memory at once. This allows you to iterate over huge data sets without loading all data into memory.
- Parameters:
pageSize
- the maximum number of results loaded at once into memory On paged UI tables the number of objects you display on a single page.- Returns:
- paged result
- Since:
- 8.0.3
- See Also:
getResultsPaged(Query)
,getResults(Query, int, int)
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
getFirstResult
V getFirstResult(Query<V> query)
Gets the first business objects that matches the givenquery
.This method considers the following parts of the
query
:- The where clauses (used to filter the business objects)
- The orderBy clauses (used to sort the resulting list)
query
:- The groupBy clauses
- The aggregation (count, avg, min, max, sum) clauses
- Parameters:
query
-- Returns:
- first business object or null if no business object matches the
query
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
getRecordset
Recordset getRecordset(Query<V> query)
Gets aRecordset
with all records that matches the givenquery
. The returned columns depend on the givenquery
:- If no
group by
oraggregation
is used, all columns of the table are returned. - If a
group by
oraggregation
is used, the columns that are specified in groupBy or aggregation (count, avg, min, max, sum) are returned.
- Parameters:
query
-- Returns:
- Recordset
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
- If no
-
getRecordset
Recordset getRecordset(Query<V> query, int startIndex, int count)
Gets aRecordset
with the records that matches the givenquery
. The returned columns depend on the givenquery
:- If no
group by
oraggregation
is used, all columns of the table are returned. - If a
group by
oraggregation
is used, the columns that are specified in groupBy or aggregation (count, avg, min, max, sum) are returned.
The parameters
startIndex
andcount
can be used to limit the number of objects that are returned.- Parameters:
query
-startIndex
- 0..n. The index of the first record is 0.count
- 0..n. Use -1 to return all beginning from the startIndex- Returns:
- Recordset
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
- If no
-
getFirstValue
Object getFirstValue(Query<V> query)
Gets the value of the first column and first record that matches the givenquery
.The first column depends on the given
query
:- If no
group by
oraggregation
is used, the first columns of the table is used. - If a
group by
oraggregation
is used, the first columns that are specified in groupBy or aggregation (count, avg, min, max, sum) is used.
- Parameters:
query
-- Returns:
- value of the first column and record that matches the given
query
. If no matching record was foundnull
is returned. - API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
- If no
-
getCount
long getCount(Query<V> query)
Counts the number of rows or business objects that matches the query.This method considers the following parts of the
query
:- The where clauses (used to filter the business objects)
- The groupBy clauses
query
:- The orderBy clauses (used to sort the resulting list)
- The aggregation (count, avg, min, max, sum) clauses
- Parameters:
query
-- Returns:
- number of rows or business objects that matches the query
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
-