Package org.dashbuilder.dataset
Interface DataSetLookupBuilder<T>
-
- All Known Implementing Classes:
AbstractDataSetLookupBuilder,DataSetLookupBuilderImpl
public interface DataSetLookupBuilder<T>A DataSetLookupBuilder allows for the assembly of a DataSetLookup instance (i.e. a DataSet lookup request) in a friendly manner. It allows the issuing of a request to obtain a view over a specific DataSet.DataSetFactory.newLookupBuilder() .dataset("target-dataset-uuid") .group("department") .column("id", COUNT, "occurrences") .column("amount", SUM, "totalAmount") .sort("totalAmount", "asc") .buildLookup();
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tasc()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.DataSetLookupbuildLookup()Tcolumn(String columnId)Select the specified column as part of the resulting data set.Tcolumn(String columnId, String newColumnId)Select the specified column as part of the resulting data set.Tcolumn(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.Tcolumn(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.Tcolumn(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.Tdataset(String uuid)The UUID reference to the source data set.Tdesc()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.Tdynamic(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.Tdynamic(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.Tdynamic(DateIntervalType intervalSize, boolean emptyAllowed)Same as "dynamic(int maxIntervals, DateIntervalType intervalSize)" but taking "maxIntervals=15" as default.Tfilter(String columnId, ColumnFilter... filter)Filter the data set according to the specified column filters.Tfilter(ColumnFilter... filter)Filter the data set according to the specified column filters.TfirstDay(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.TfirstMonth(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.Tfixed(DateIntervalType type, boolean emptyAllowed)Set the grouping strategy to a fixed date interval on a previously defined date group operation.Tgroup(String columnId)Group the data set by one of the columnsTgroup(String columnId, String newColumnId)Group the data set by one of the columns.Tgroup(String columnId, String newColumnId, boolean b)Tjoin()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).TrowNumber(int rows)Set the number of rows for the data set.TrowOffset(int offset)Set a row offset for the data set.Tselect(String... intervalNames)The function will reduce the generated data set by selecting some of the intervals that were previously generated through a group operation.Tsort(String columnId, String order)Will apply the specified sort order over the indicated data set column.Tsort(String columnId, SortOrder order)Will apply the specified sort order over the indicated data set column.
-
-
-
Method Detail
-
rowOffset
T rowOffset(int offset)
Set a row offset for the data set.- 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
T rowNumber(int rows)
Set the number of rows for the data set.- 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
T group(String columnId)
Group the data set by one of the columns- 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
T group(String columnId, String newColumnId)
Group the data set by one of the columns. The resulting group will be given the new column identifier.- Parameters:
columnId- The column identifiernewColumnId- The identifier for the group column- Returns:
- The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
-
join
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). 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.
- Returns:
- The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
-
asc
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.- Returns:
- The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
-
desc
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.- Returns:
- The DataSetLookupBuilder instance that is being used to configure a DataSetLookup request.
-
dynamic
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. By default the DYNAMIC GroupStrategy will be applied.- 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
-
dynamic
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.
-
dynamic
T dynamic(DateIntervalType intervalSize, boolean emptyAllowed)
Same as "dynamic(int maxIntervals, DateIntervalType intervalSize)" but taking "maxIntervals=15" as default.
-
fixed
T fixed(DateIntervalType type, boolean emptyAllowed)
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.- Parameters:
type- The size of the date interval. Only the following types are supported: QUARTER, MONTH, DAY_OF_WEEK, HOUR, MINUTE, SECONDemptyAllowed- 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
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. It will indicate the resulting data set that it has to show the specified day of the week as the first interval.- 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
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. It will indicate the resulting data set that it has to show the specified month as the first interval.- 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
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. 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.- 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
T filter(ColumnFilter... filter)
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".- Parameters:
filter- 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
T filter(String columnId, ColumnFilter... filter)
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.- Parameters:
columnId- The identifier of the column that the filter array should be applied onfilter- 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
T sort(String columnId, String order)
Will apply the specified sort order over the indicated data set column.- 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
T sort(String columnId, SortOrder order)
Will apply the specified sort order over the indicated data set column.- 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
T column(String columnId)
Select the specified column as part of the resulting data set.- Parameters:
columnId- The identifier of the source column.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
column
T column(String columnId, String newColumnId)
Select the specified column as part of the resulting data set.- 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
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.- 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
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.This variant requires a previous group() method invocation as it's not possible to apply aggregation functions on non-grouped data sets.
- 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.
-
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.This variant does not require a source column which is fine for some aggregation functions like AggregateFunctionType.COUNT
- 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.
-
buildLookup
DataSetLookup buildLookup()
- Returns:
- The DataSetLookup request instance that has been configured.
-
-