public interface DataSetLookupBuilder<T>
DataSetFactory.newLookupBuilder()
.dataset("target-dataset-uuid")
.group("department")
.column("id", COUNT, "occurrences")
.column("amount", SUM, "totalAmount")
.sort("totalAmount", "asc")
.buildLookup();
| Modifier and Type | Method and 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.
|
DataSetLookup |
buildLookup() |
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 |
column(String columnId)
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(String columnId,
String newColumnId)
Select the specified column as part of the resulting data set.
|
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(DateIntervalType intervalSize,
boolean emptyAllowed)
Same as "dynamic(int maxIntervals, DateIntervalType intervalSize)" but taking
"maxIntervals=15" as default.
|
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 |
filter(ColumnFilter... filter)
Filter the data set according to the specified column filters.
|
T |
filter(String columnId,
ColumnFilter... filter)
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 type,
boolean emptyAllowed)
Set the grouping strategy to a fixed date interval on a previously defined date group operation.
|
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 |
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,
SortOrder order)
Will apply the specified sort order over the indicated data set column.
|
T |
sort(String columnId,
String order)
Will apply the specified sort order over the indicated data set column.
|
T rowOffset(int offset)
offset - The row offset for the resulting data set (starting at 0).T rowNumber(int rows)
rows - The number of rows for the resulting data set.T group(String columnId)
columnId - The column identifier of the column to be groupedT group(String columnId, String newColumnId)
columnId - The column identifiernewColumnId - The identifier for the group columnT join()
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.
T asc()
T desc()
T dynamic(int maxIntervals, DateIntervalType intervalSize, boolean emptyAllowed)
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.GroupStrategy,
DateIntervalTypeT dynamic(int maxIntervals, boolean emptyAllowed)
T dynamic(DateIntervalType intervalSize, boolean emptyAllowed)
T fixed(DateIntervalType type, boolean emptyAllowed)
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.
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.DateIntervalTypeT firstDay(DayOfWeek dayOfWeek)
dayOfWeek - The day of the week that should be shown as the graph's first interval.DateIntervalTypeT firstMonth(Month month)
month - The month that should be shown as the graph's first interval.DateIntervalTypeT select(String... intervalNames)
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.intervalNames - The interval names that should be preserved in the data set that is being generated.T filter(ColumnFilter... filter)
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".filter - The filters to be applied on the data set's columnColumnFilter,
FilterFactoryT filter(String columnId, ColumnFilter... filter)
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.columnId - The identifier of the column that the filter array should be applied onfilter - The filters to be applied on the data set's columnColumnFilter,
FilterFactoryT sort(String columnId, String order)
columnId - The identifier of the column that should be sorted.order - The sort order, specified as a String. Accepted values are "asc" and "desc".T sort(String columnId, SortOrder order)
columnId - The identifier of the column that should be sorted.order - The sort order.SortOrderT column(String columnId)
columnId - The identifier of the source column.T column(String columnId, String newColumnId)
columnId - The identifier of the source column.newColumnId - A new identifier for the column into the resulting data set.T column(String columnId, AggregateFunctionType function)
columnId - The identifier of the source column.function - The AggregationFunction for calculating the column values.T column(String columnId, AggregateFunctionType function, String newColumnId)
This variant requires a previous group() method invocation as it's not possible to apply aggregation functions on non-grouped data sets.
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.T column(AggregateFunctionType function, String newColumnId)
This variant does not require a source column which is fine for some aggregation functions like AggregateFunctionType.COUNT
function - The aggregation function for calculating the column values.newColumnId - A new identifier for the column into the resulting data set.DataSetLookup buildLookup()
Copyright © 2017–2021 JBoss by Red Hat. All rights reserved.