Interface IQueryExecutor<V>
- Type Parameters:
V- the business object class
- All Known Subinterfaces:
ICaseQueryExecutor,IIntermediateEventQueryExecutor,ITaskQueryExecutor,IUserQueryExecutor,IWorkflowEventQueryExecutor
- Since:
- 11.1.2012
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionlongCounts the number of rows or business objects that matches the query.getFirstResult(Query<V> query) Gets the first business objects that matches the givenquery.getFirstValue(Query<V> query) Gets the value of the first column and first record that matches the givenquery.getRecordset(Query<V> query) Gets aRecordsetwith all records that matches the givenquery.getRecordset(Query<V> query, int startIndex, int count) Gets aRecordsetwith the records that matches the givenquery.getResults(Query<V> query) Gets all business objects that matches the givenquery.getResults(Query<V> query, int startIndex, int count) Gets all business objects that matches the givenquery.getResultsPaged(Query<V> query) Gets the results page wise.getResultsPaged(Query<V> query, int pageSize) Gets the results page wise.
-
Method Details
-
getResults
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:
- API:
- This public API is available in Java.
-
getResults
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
startIndexandcountcan 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 Java.
-
getResultsPaged
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:
- API:
- This public API is available in Java.
-
getResultsPaged
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:
- API:
- This public API is available in Java.
-
getFirstResult
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 Java.
-
getRecordset
Gets aRecordsetwith all records that matches the givenquery. The returned columns depend on the givenquery:- If no
group byoraggregationis used, all columns of the table are returned. - If a
group byoraggregationis 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 Java.
- If no
-
getRecordset
Gets aRecordsetwith the records that matches the givenquery. The returned columns depend on the givenquery:- If no
group byoraggregationis used, all columns of the table are returned. - If a
group byoraggregationis used, the columns that are specified in groupBy or aggregation (count, avg, min, max, sum) are returned.
The parameters
startIndexandcountcan 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 Java.
- If no
-
getFirstValue
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 byoraggregationis used, the first columns of the table is used. - If a
group byoraggregationis 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 foundnullis returned. - API:
- This public API is available in Java.
- If no
-
getCount
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 Java.
-