public abstract class AbstractDataSetLookupBuilder<T> extends Object implements DataSetLookupBuilder<T>
| Constructor and Description |
|---|
AbstractDataSetLookupBuilder() |
| 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.
|
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(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... filters)
Filter the data set according to the specified column filters.
|
T |
filter(String columnId,
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 |
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.
|
protected DataSetOp getCurrentOp()
public T dataset(String uuid)
DataSetLookupBuilderdataset in interface DataSetLookupBuilder<T>public T rowOffset(int offset)
DataSetLookupBuilderrowOffset in interface DataSetLookupBuilder<T>offset - The row offset for the resulting data set (starting at 0).public T rowNumber(int rows)
DataSetLookupBuilderrowNumber in interface DataSetLookupBuilder<T>rows - The number of rows for the resulting data set.public T group(String columnId)
DataSetLookupBuildergroup in interface DataSetLookupBuilder<T>columnId - The column identifier of the column to be groupedpublic T group(String columnId, String newColumnId)
DataSetLookupBuildergroup in interface DataSetLookupBuilder<T>columnId - The column identifiernewColumnId - The identifier for the group columnpublic T join()
DataSetLookupBuilderGroup 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.
join in interface DataSetLookupBuilder<T>public T asc()
DataSetLookupBuilderasc in interface DataSetLookupBuilder<T>public T desc()
DataSetLookupBuilderdesc in interface DataSetLookupBuilder<T>public T dynamic(int maxIntervals, boolean emptyAllowed)
DataSetLookupBuilderdynamic in interface DataSetLookupBuilder<T>public T dynamic(int maxIntervals, DateIntervalType intervalSize, boolean emptyAllowed)
DataSetLookupBuilderdynamic in interface DataSetLookupBuilder<T>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,
DateIntervalTypepublic T dynamic(DateIntervalType intervalSize, boolean emptyAllowed)
DataSetLookupBuilderdynamic in interface DataSetLookupBuilder<T>public T fixed(DateIntervalType intervalSize, boolean emptyAllowed)
DataSetLookupBuilderDataSetFactory.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.
fixed in interface DataSetLookupBuilder<T>intervalSize - 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.DateIntervalTypepublic T firstDay(DayOfWeek dayOfWeek)
DataSetLookupBuilderfirstDay in interface DataSetLookupBuilder<T>dayOfWeek - The day of the week that should be shown as the graph's first interval.DateIntervalTypepublic T firstMonth(Month month)
DataSetLookupBuilderfirstMonth in interface DataSetLookupBuilder<T>month - The month that should be shown as the graph's first interval.DateIntervalTypepublic T select(String... intervalNames)
DataSetLookupBuilder
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.select in interface DataSetLookupBuilder<T>intervalNames - The interval names that should be preserved in the data set that is being generated.public T filter(ColumnFilter... filters)
DataSetLookupBuilder
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 in interface DataSetLookupBuilder<T>filters - The filters to be applied on the data set's columnColumnFilter,
FilterFactorypublic T filter(String columnId, ColumnFilter... filters)
DataSetLookupBuilder
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.filter in interface DataSetLookupBuilder<T>columnId - The identifier of the column that the filter array should be applied onfilters - The filters to be applied on the data set's columnColumnFilter,
FilterFactorypublic T sort(String columnId, String order)
DataSetLookupBuildersort in interface DataSetLookupBuilder<T>columnId - The identifier of the column that should be sorted.order - The sort order, specified as a String. Accepted values are "asc" and "desc".public T sort(String columnId, SortOrder order)
DataSetLookupBuildersort in interface DataSetLookupBuilder<T>columnId - The identifier of the column that should be sorted.order - The sort order.SortOrderpublic T column(String columnId)
DataSetLookupBuildercolumn in interface DataSetLookupBuilder<T>columnId - The identifier of the source column.public T column(String columnId, String newColumnId)
DataSetLookupBuildercolumn in interface DataSetLookupBuilder<T>columnId - The identifier of the source column.newColumnId - A new identifier for the column into the resulting data set.public T column(String columnId, AggregateFunctionType function)
DataSetLookupBuildercolumn in interface DataSetLookupBuilder<T>columnId - The identifier of the source column.function - The AggregationFunction for calculating the column values.public T column(AggregateFunctionType function, String newColumnId)
DataSetLookupBuilderThis variant does not require a source column which is fine for some aggregation functions like AggregateFunctionType.COUNT
column in interface DataSetLookupBuilder<T>function - The aggregation function for calculating the column values.newColumnId - A new identifier for the column into the resulting data set.public T column(String columnId, AggregateFunctionType function, String newColumnId)
DataSetLookupBuilderThis variant requires a previous group() method invocation as it's not possible to apply aggregation functions on non-grouped data sets.
column in interface DataSetLookupBuilder<T>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.public DataSetLookup buildLookup()
buildLookup in interface DataSetLookupBuilder<T>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.
sourceId - The source column identifier.function - The aggregate function.Copyright © 2017–2020 JBoss by Red Hat. All rights reserved.