@sap/odata-v4
Version:
OData V4.0 server library
59 lines (50 loc) • 1.44 kB
JavaScript
;
const Transformation = require('./Transformation');
/**
* Grouping transformation.
*
* @extends Transformation
* @hideconstructor
*/
class GroupByTransformation extends Transformation {
constructor() {
super(Transformation.TransformationKind.GROUP_BY);
this._items = [];
this._transformations = [];
}
/**
* Return the items to group.
* @returns {GroupByItem[]} a non-empty list of group-by items
*/
getGroupByItems() {
return this._items;
}
/**
* Add a group-by item.
* @param {GroupByItem} item the group-by item
* @returns {GroupByTransformation} this group-by transformation
* @package
*/
addGroupByItem(item) {
this._items.push(item);
return this;
}
/**
* Return the transformations to be applied to the grouped items.
* @returns {Transformation[]} a non-empty list of transformations
*/
getTransformations() {
return this._transformations;
}
/**
* Set the transformations to be applied to the grouped items.
* @param {Transformation[]} transformations a non-empty list of transformations
* @returns {GroupByTransformation} this group-by transformation
* @package
*/
setTransformations(transformations) {
this._transformations = transformations;
return this;
}
}
module.exports = GroupByTransformation;