Class AggregatableDelegate<K>
java.lang.Object
io.jmix.flowui.data.aggregation.impl.AggregatableDelegate<K>
- Type Parameters:
K- the type of the key used to identify items for aggregation
@Component("flowui_AggregatableDelegate")
@Scope("prototype")
public class AggregatableDelegate<K>
extends Object
A delegate component responsible for performing data aggregation operations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Aggregationsprotected CurrentAuthenticationprotected DatatypeRegistryprotected BiFunction<K,MetaPropertyPath, Object> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaggregate(AggregationInfo[] aggregationInfos, Collection<K> itemsIds) Aggregates data based on an array ofAggregationInfoobjects and a collection of item identifiers.aggregateValues(AggregationInfo[] aggregationInfos, Collection<K> itemIds) Aggregates values based on the providedAggregationInfoarray and collection of item identifiers.protected Map<AggregationInfo,String> doAggregation(AggregationInfo[] aggregationInfos, Collection<K> itemIds) protected ObjectdoPropertyAggregation(AggregationInfo aggregationInfo, Collection<K> itemIds) voidsetAggregations(Aggregations aggregations) voidsetCurrentAuthentication(CurrentAuthentication currentAuthentication) voidsetDatatypeRegistry(DatatypeRegistry datatypeRegistry) voidsetItemProvider(Function<K, Object> itemProvider) Sets the item provider function that determines how items are provided based on their identifier.voidsetItemValueProvider(BiFunction<K, MetaPropertyPath, Object> itemValueProvider) Sets the item value provider function that determines how values are resolved for items.protected List<?>valuesByProperty(MetaPropertyPath propertyPath, Collection<K> itemIds)
-
Field Details
-
aggregations
-
currentAuthentication
-
datatypeRegistry
-
itemProvider
-
itemValueProvider
-
-
Constructor Details
-
AggregatableDelegate
public AggregatableDelegate()
-
-
Method Details
-
setAggregations
-
setCurrentAuthentication
-
setDatatypeRegistry
-
setItemProvider
Sets the item provider function that determines how items are provided based on their identifier.- Parameters:
itemProvider- a function to set
-
setItemValueProvider
Sets the item value provider function that determines how values are resolved for items.- Parameters:
itemValueProvider- a function to set
-
aggregate
public Map<AggregationInfo,String> aggregate(AggregationInfo[] aggregationInfos, Collection<K> itemsIds) Aggregates data based on an array ofAggregationInfoobjects and a collection of item identifiers.- Parameters:
aggregationInfos- an array ofAggregationInfoobjects that define the type and properties for aggregationitemsIds- a collection of item identifiers representing the items subjected to aggregation- Returns:
- a map representing the formatted result of the aggregation for the given info
- Throws:
NullPointerException- ifaggregationInfosoritemsIdsisnull.IllegalStateException- if theaggregationInfosarray is empty.
-
aggregateValues
public Map<AggregationInfo,Object> aggregateValues(AggregationInfo[] aggregationInfos, Collection<K> itemIds) Aggregates values based on the providedAggregationInfoarray and collection of item identifiers.- Parameters:
aggregationInfos- an array ofAggregationInfoobjectsitemIds- a collection of item identifiers representing the items to aggregate values from- Returns:
- a map representing the result of the aggregation for the given info
-
doAggregation
protected Map<AggregationInfo,String> doAggregation(AggregationInfo[] aggregationInfos, Collection<K> itemIds) -
doPropertyAggregation
@Nullable protected Object doPropertyAggregation(AggregationInfo aggregationInfo, Collection<K> itemIds) -
valuesByProperty
-