Class AbstractDataSetLookupBuilder<T>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T asc()
      This call will operate only on a previously grouped data set (i.e. one of the group() methods has been called previously on the data set lookup), and will result in that the grouped column is ordered in ascending order.
      protected String buildColumnId​(String sourceId, AggregateFunctionType function)
      Builds a column identifier when applying an aggregate function to the column, but no id is specified.
      DataSetLookup buildLookup()  
      T column​(String columnId)
      Select the specified column as part of the resulting data set.
      T column​(String columnId, String newColumnId)
      Select the specified column as part of the resulting data set.
      T column​(String columnId, AggregateFunctionType function)
      Generates a new column on the resulting data set by which values will be the result of applying the specified aggregation function on the source data set column.
      T column​(String columnId, AggregateFunctionType function, String newColumnId)
      Generates a new column on the resulting data set by which values will be the result of applying the specified aggregation function on the source data set column.
      T column​(AggregateFunctionType function, String newColumnId)
      Generates a new column on the resulting data set by which values will be the result of applying the specified aggregation function on the source data set column.
      T dataset​(String uuid)
      The UUID reference to the source data set.
      T desc()
      This call will operate only on a previously grouped data set (i.e. one of the group() methods has been called previously on the data set lookup), and will result in that the grouped column is ordered in descending order.
      T dynamic​(int maxIntervals, boolean emptyAllowed)
      Same as "dynamic(int maxIntervals, DateIntervalType intervalSize)" but in this case the "intervalSize" is dynamically calculated to the minimum size that generates less intervals than the "maxIntervals" specified.
      T dynamic​(int maxIntervals, DateIntervalType intervalSize, boolean emptyAllowed)
      Group the data set by one of the columns, of type ColumnType.Date, specifying the size of the date interval by which the column should be grouped.
      T dynamic​(DateIntervalType intervalSize, boolean emptyAllowed)
      Same as "dynamic(int maxIntervals, DateIntervalType intervalSize)" but taking "maxIntervals=15" as default.
      T filter​(String columnId, ColumnFilter... filters)
      Filter the data set according to the specified column filters.
      T filter​(ColumnFilter... filters)
      Filter the data set according to the specified column filters.
      T firstDay​(DayOfWeek dayOfWeek)
      This call requires a previously grouped data set with fixed DateIntervalType.DAY_OF_WEEK intervals, i.e. both group() and fixed(DateIntervalType.DAY_OF_WEEK) have to be invoked previously.
      T firstMonth​(Month month)
      This call requires a previously grouped data set with fixed DateIntervalType.MONTH intervals, i.e. both group() and fixed(DateIntervalType.MONTH) have to be invoked previously.
      T fixed​(DateIntervalType intervalSize, boolean emptyAllowed)
      Set the grouping strategy to a fixed date interval on a previously defined date group operation.
      protected DataSetOp getCurrentOp()  
      T group​(String columnId)
      Group the data set by one of the columns
      T group​(String columnId, String newColumnId)
      Group the data set by one of the columns.
      T group​(String columnId, String newColumnId, boolean postEnabled)  
      T join()
      This call will operate only on a previously grouped data set (i.e. one of the group() methods has been called previously on the data set lookup), and it's used to indicate that the group results must be joined with the group results of a previous group operation (if any).
      T rowNumber​(int rows)
      Set the number of rows for the data set.
      T rowOffset​(int offset)
      Set a row offset for the data set.
      T select​(String... intervalNames)
      The function will reduce the generated data set by selecting some of the intervals that were previously generated through a group operation.
      T sort​(String columnId, String order)
      Will apply the specified sort order over the indicated data set column.
      T sort​(String columnId, SortOrder order)
      Will apply the specified sort order over the indicated data set column.
    • Constructor Detail

      • AbstractDataSetLookupBuilder

        public AbstractDataSetLookupBuilder()
    • Method Detail

      • getCurrentOp

        protected DataSetOp getCurrentOp()
      • rowOffset

        public T rowOffset​(int offset)
        Description copied from interface: DataSetLookupBuilder
        Set a row offset for the data set.
        Specified by:
        rowOffset in interface DataSetLookupBuilder<T>
        Parameters:
        offset - The row offset for the resulting data set (starting at 0).
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
      • rowNumber

        public T rowNumber​(int rows)
        Description copied from interface: DataSetLookupBuilder
        Set the number of rows for the data set.
        Specified by:
        rowNumber in interface DataSetLookupBuilder<T>
        Parameters:
        rows - The number of rows for the resulting data set.
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
      • group

        public T group​(String columnId)
        Description copied from interface: DataSetLookupBuilder
        Group the data set by one of the columns
        Specified by:
        group in interface DataSetLookupBuilder<T>
        Parameters:
        columnId - The column identifier of the column to be grouped
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
      • group

        public T group​(String columnId,
                       String newColumnId)
        Description copied from interface: DataSetLookupBuilder
        Group the data set by one of the columns. The resulting group will be given the new column identifier.
        Specified by:
        group in interface DataSetLookupBuilder<T>
        Parameters:
        columnId - The column identifier
        newColumnId - The identifier for the group column
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
      • join

        public T join()
        Description copied from interface: DataSetLookupBuilder
        This call will operate only on a previously grouped data set (i.e. one of the group() methods has been called previously on the data set lookup), and it's used to indicate that the group results must be joined with the group results of a previous group operation (if any). Example:
        • .group(PIPELINE)
        • .group(COUNTRY).join()
        • .column(PIPELINE)
        • .column(COUNTRY)
        • .column(AMOUNT, SUM, "TOTAL")

        Group by PIPELINE:

        
           --------------------------
           | PIPELINE   | TOTAL     |
           --------------------------
           | EARLY      | 369.09    |
           | ADVANCED   | 246.06    |
           --------------------------
         

        Group by COUNTRY:

        
           ------------------------
           | COUNTRY  | TOTAL     |
           ------------------------
           | USA      | 369.09    |
           | UK       | 246.06    |
           | Spain    | 369.09    |
           ------------------------
         

        Result:

        
           ---------------------------------------
           | PIPELINE   |  COUNTRY   | TOTAL     |
           ---------------------------------------
           | EARLY      |  USA       | 123.03    |
           | EARLY      |  UK        | 123.03    |
           | EARLY      |  Spain     | 123.03    |
           | ADVANCED   |  USA       | 123.03    |
           | ADVANCED   |  Spain     | 123.03    |
           | STANDBY    |  USA       | 123.03    |
           | STANDBY    |  UK        | 123.03    |
           | STANDBY    |  Spain     | 123.03    |
           ---------------------------------------
         

        A joined data set grouped by PIPELINE/COUNTRY is returned.

        Specified by:
        join in interface DataSetLookupBuilder<T>
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
      • asc

        public T asc()
        Description copied from interface: DataSetLookupBuilder
        This call will operate only on a previously grouped data set (i.e. one of the group() methods has been called previously on the data set lookup), and will result in that the grouped column is ordered in ascending order.
        Specified by:
        asc in interface DataSetLookupBuilder<T>
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
      • desc

        public T desc()
        Description copied from interface: DataSetLookupBuilder
        This call will operate only on a previously grouped data set (i.e. one of the group() methods has been called previously on the data set lookup), and will result in that the grouped column is ordered in descending order.
        Specified by:
        desc in interface DataSetLookupBuilder<T>
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
      • dynamic

        public T dynamic​(int maxIntervals,
                         boolean emptyAllowed)
        Description copied from interface: DataSetLookupBuilder
        Same as "dynamic(int maxIntervals, DateIntervalType intervalSize)" but in this case the "intervalSize" is dynamically calculated to the minimum size that generates less intervals than the "maxIntervals" specified.
        Specified by:
        dynamic in interface DataSetLookupBuilder<T>
      • dynamic

        public T dynamic​(int maxIntervals,
                         DateIntervalType intervalSize,
                         boolean emptyAllowed)
        Description copied from interface: DataSetLookupBuilder
        Group the data set by one of the columns, of type ColumnType.Date, specifying the size of the date interval by which the column should be grouped. By default the DYNAMIC GroupStrategy will be applied.
        Specified by:
        dynamic in interface DataSetLookupBuilder<T>
        Parameters:
        maxIntervals - The maximum number of date intervals that should appear on the graph. The DYNAMIC GroupStrategy implies that if, after grouping, more intervals are generated than the specified amount, a 'greater' DateIntervalType will be applied. For example:
           DataSetFactory.newDataSetLookupBuilder()
           .dataset(SALES_OPPS)
           .group(CLOSING_DATE).dynamic(80, MONTH)
         
        will group the data set by its closing date column, in monthly intervals, up to a maximum 80 months. If this dataset's time-span exceeds this number of months, then the next bigger DateIntervalType (i.e. QUARTER) will be applied.
        intervalSize - The size of the date interval.
        emptyAllowed - If true then empty intervals will be also considered part of the resulting data set.
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
        See Also:
        GroupStrategy, DateIntervalType
      • fixed

        public T fixed​(DateIntervalType intervalSize,
                       boolean emptyAllowed)
        Description copied from interface: DataSetLookupBuilder
        Set the grouping strategy to a fixed date interval on a previously defined date group operation. Example:
           DataSetFactory.newDataSetLookupBuilder()
           .dataset(SALES_OPPS)
           .group(CLOSING_DATE)
           .fixed(MONTH).firstMonth(JANUARY)
         
        will group the data set by a column identified by 'CLOSING_DATE', into a fixed monthly interval, starting with January as the first month interval.
        Specified by:
        fixed in interface DataSetLookupBuilder<T>
        Parameters:
        intervalSize - The size of the date interval. Only the following types are supported: QUARTER, MONTH, DAY_OF_WEEK, HOUR, MINUTE, SECOND
        emptyAllowed - If true then empty intervals will be also considered part of the resulting data set.
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
        See Also:
        DateIntervalType
      • firstDay

        public T firstDay​(DayOfWeek dayOfWeek)
        Description copied from interface: DataSetLookupBuilder
        This call requires a previously grouped data set with fixed DateIntervalType.DAY_OF_WEEK intervals, i.e. both group() and fixed(DateIntervalType.DAY_OF_WEEK) have to be invoked previously. It will indicate the resulting data set that it has to show the specified day of the week as the first interval.
        Specified by:
        firstDay in interface DataSetLookupBuilder<T>
        Parameters:
        dayOfWeek - The day of the week that should be shown as the graph's first interval.
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
        See Also:
        DateIntervalType
      • firstMonth

        public T firstMonth​(Month month)
        Description copied from interface: DataSetLookupBuilder
        This call requires a previously grouped data set with fixed DateIntervalType.MONTH intervals, i.e. both group() and fixed(DateIntervalType.MONTH) have to be invoked previously. It will indicate the resulting data set that it has to show the specified month as the first interval.
        Specified by:
        firstMonth in interface DataSetLookupBuilder<T>
        Parameters:
        month - The month that should be shown as the graph's first interval.
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
        See Also:
        DateIntervalType
      • select

        public T select​(String... intervalNames)
        Description copied from interface: DataSetLookupBuilder
        The function will reduce the generated data set by selecting some of the intervals that were previously generated through a group operation. For example:
           DataSetFactory.newDataSetLookupBuilder()
           .dataset(EXPENSE_REPORTS)
           .group("department", "Department")
           .select("Services", "Engineering", "Support")
           .count( "Occurrences" )
           .buildLookup());
         
        Will group the expense reports data set by department, select only the "Services", "Engineering" and "Support" intervals, and count how many times each of those occurs respectively.
        Specified by:
        select in interface DataSetLookupBuilder<T>
        Parameters:
        intervalNames - The interval names that should be preserved in the data set that is being generated.
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
      • filter

        public T filter​(ColumnFilter... filters)
        Description copied from interface: DataSetLookupBuilder
        Filter the data set according to the specified column filters. All column filters will need to explicitly reference the column (through its corresponding identifier) that they need to be applied on. For example:
           DataSetFactory.newDataSetLookupBuilder()
           .dataset(EXPENSE_REPORTS)
           .filter(AND(
                       equalsTo("department", "Sales"),
                       OR(
                         NOT(lowerThan("amount", 300)),
                         equalsTo("city", "Madrid")
                       )
                   )
           )
           .buildLookup());
         
        Will limit the expense reports data set such that for all obtained records, the department will always equal "Sales", and either the amount will not be lower than 300, or the city will be equal to "Madrid".
        Specified by:
        filter in interface DataSetLookupBuilder<T>
        Parameters:
        filters - The filters to be applied on the data set's column
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
        See Also:
        ColumnFilter, FilterFactory
      • filter

        public T filter​(String columnId,
                        ColumnFilter... filters)
        Description copied from interface: DataSetLookupBuilder
        Filter the data set according to the specified column filters. The specified column identifier allows to specify column filters without explicitly passing in the column identifier with them, they will simply 'inherit'. For example:
           DataSetFactory.newDataSetLookupBuilder()
           .dataset(EXPENSE_REPORTS)
           .filter("amount",
                   AND(
                       equalsTo("department", "Sales"),
                       OR(
                         NOT(lowerThan(300)),
                         equalsTo("city", "Madrid")
                       )
                   )
           )
           .buildLookup());
         
        Will limit the expense reports data set such that for all obtained records, the department will always equal "Sales", and either the amount will not be lower than 300, or the city will be equal to "Madrid". Since the lowerThan filter does not reference a column, it implicitly refers to the amount column.
        Specified by:
        filter in interface DataSetLookupBuilder<T>
        Parameters:
        columnId - The identifier of the column that the filter array should be applied on
        filters - The filters to be applied on the data set's column
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
        See Also:
        ColumnFilter, FilterFactory
      • sort

        public T sort​(String columnId,
                      String order)
        Description copied from interface: DataSetLookupBuilder
        Will apply the specified sort order over the indicated data set column.
        Specified by:
        sort in interface DataSetLookupBuilder<T>
        Parameters:
        columnId - The identifier of the column that should be sorted.
        order - The sort order, specified as a String. Accepted values are "asc" and "desc".
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
      • sort

        public T sort​(String columnId,
                      SortOrder order)
        Description copied from interface: DataSetLookupBuilder
        Will apply the specified sort order over the indicated data set column.
        Specified by:
        sort in interface DataSetLookupBuilder<T>
        Parameters:
        columnId - The identifier of the column that should be sorted.
        order - The sort order.
        Returns:
        The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
        See Also:
        SortOrder
      • column

        public T column​(String columnId)
        Description copied from interface: DataSetLookupBuilder
        Select the specified column as part of the resulting data set.
        Specified by:
        column in interface DataSetLookupBuilder<T>
        Parameters:
        columnId - The identifier of the source column.
        Returns:
        The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
      • column

        public T column​(String columnId,
                        String newColumnId)
        Description copied from interface: DataSetLookupBuilder
        Select the specified column as part of the resulting data set.
        Specified by:
        column in interface DataSetLookupBuilder<T>
        Parameters:
        columnId - The identifier of the source column.
        newColumnId - A new identifier for the column into the resulting data set.
        Returns:
        The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
      • column

        public T column​(String columnId,
                        AggregateFunctionType function)
        Description copied from interface: DataSetLookupBuilder
        Generates a new column on the resulting data set by which values will be the result of applying the specified aggregation function on the source data set column.
        Specified by:
        column in interface DataSetLookupBuilder<T>
        Parameters:
        columnId - The identifier of the source column.
        function - The AggregationFunction for calculating the column values.
        Returns:
        The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
      • column

        public T column​(AggregateFunctionType function,
                        String newColumnId)
        Description copied from interface: DataSetLookupBuilder
        Generates a new column on the resulting data set by which values will be the result of applying the specified aggregation function on the source data set column.

        This variant does not require a source column which is fine for some aggregation functions like AggregateFunctionType.COUNT

        Specified by:
        column in interface DataSetLookupBuilder<T>
        Parameters:
        function - The aggregation function for calculating the column values.
        newColumnId - A new identifier for the column into the resulting data set.
        Returns:
        The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
      • column

        public T column​(String columnId,
                        AggregateFunctionType function,
                        String newColumnId)
        Description copied from interface: DataSetLookupBuilder
        Generates a new column on the resulting data set by which values will be the result of applying the specified aggregation function on the source data set column.

        This variant requires a previous group() method invocation as it's not possible to apply aggregation functions on non-grouped data sets.

        Specified by:
        column in interface DataSetLookupBuilder<T>
        Parameters:
        columnId - The identifier of the source column.
        function - The aggregation function for calculating the column values.
        newColumnId - A new identifier for the column into the resulting data set.
        Returns:
        The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
      • buildColumnId

        protected String buildColumnId​(String sourceId,
                                       AggregateFunctionType function)

        Builds a column identifier when applying an aggregate function to the column, but no id is specified.

        It follows the nomenclature: sourceId_function.

        Parameters:
        sourceId - The source column identifier.
        function - The aggregate function.
        Returns:
        A new column identifier.