Interface IFluentQueryExecutor<V>

  • Type Parameters:
    V - entity type

    public interface IFluentQueryExecutor<V>
    Executor for a built Query.
    API:
    This is a public API.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long count()
      Counts the number of rows or business objects that matches the query.
      V firstResult()
      Gets the first business objects that matches the given query.
      Object firstValue()
      Gets the value of the first column and first record that matches the given query.
      Recordset recordset()
      Gets a Recordset with all records that matches the given query.
      Recordset recordset​(int startIndex, int count)
      Gets a Recordset with the records that matches the given query.
      List<V> results()
      Gets all business objects that matches the given query.
      List<V> results​(int startIndex, int count)
      Gets all business objects that matches the given query.
      IPagedResult<V> resultsPaged()
      Gets the results page wise.
      IPagedResult<V> resultsPaged​(int pageSize)
      Gets the results page wise.
    • Method Detail

      • results

        List<V> results()

        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 using results(int, int), resultsPaged()

        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)

        This method ignores the following parts of the query:

        • The groupBy clauses
        • The aggregation (count, avg, min, max, sum) clauses

        Returns:
        list of matching business objects
        See Also:
        results(int, int), resultsPaged(), resultsPaged(int)
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • results

        List<V> results​(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)

        This method ignores the following parts of the query:

        • The groupBy clauses
        • The aggregation (count, avg, min, max, sum) clauses

        The parameters startIndex and count can be used to limit the number of objects that are returned.

        Parameters:
        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
        See Also:
        resultsPaged(), resultsPaged(int)
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • resultsPaged

        IPagedResult<V> resultsPaged()

        Gets the results page wise.

        You can use this method in a for each loop to iterate over the results:

         for (V businessObject : query.executor().resultsPaged())
         {
           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 query.executor().resultsPaged().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)
        This method ignores the following parts of the 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:
        resultsPaged(int), results(int, int)
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • resultsPaged

        IPagedResult<V> resultsPaged​(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 : query.executor().resultsPaged(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 query.executor().resultsPaged(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)
        This method ignores the following parts of the 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:
        resultsPaged(), results(int, int)
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • firstResult

        V firstResult()
        Gets the first 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)

        This method ignores the following parts of the query:

        • The groupBy clauses
        • The aggregation (count, avg, min, max, sum) clauses

        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.
      • recordset

        Recordset recordset()
        Gets a Recordset with all records that matches the given query. The returned columns depend on the given query:
        • If no group by or aggregation is used, all columns of the table are returned.
        • If a group by or aggregation is used, the columns that are specified in groupBy or aggregation (count, avg, min, max, sum) are returned.
        Returns:
        Recordset
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • recordset

        Recordset recordset​(int startIndex,
                            int count)
        Gets a Recordset with the records that matches the given query. The returned columns depend on the given query:
        • If no group by or aggregation is used, all columns of the table are returned.
        • If a group by or aggregation is used, the columns that are specified in groupBy or aggregation (count, avg, min, max, sum) are returned.

        The parameters startIndex and count can be used to limit the number of objects that are returned.

        Parameters:
        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.
      • firstValue

        Object firstValue()
        Gets the value of the first column and first record that matches the given query.

        The first column depends on the given query:

        • If no group by or aggregation is used, the first columns of the table is used.
        • If a group by or aggregation is used, the first columns that are specified in groupBy or aggregation (count, avg, min, max, sum) is used.

        Returns:
        value of the first column and record that matches the given query. If no matching record was found null is returned.
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • count

        long count()
        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

        This method ignores the following parts of the query:

        • The orderBy clauses (used to sort the resulting list)
        • The aggregation (count, avg, min, max, sum) clauses

        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.