Class AggregationUtility<T extends AggregatedRecord<T,?>>
- java.lang.Object
-
- org.gcube.documentstore.records.aggregation.AggregationUtility<T>
-
public class AggregationUtility<T extends AggregatedRecord<T,?>> extends Object
- Author:
- Luca Frosini (ISTI - CNR)
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<String>aggregationFieldsprotected Set<String>neededFieldsprotected Tt
-
Constructor Summary
Constructors Constructor Description AggregationUtility(T t)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Taggregate(T record)protected voidcleanExtraFields()Remove all fields which are not in AggregationFields nor in AggregatedFields SetsbooleanisAggregable(T record)Check if the record provided as argument is aggregable with the one provided to the Constructor.voidsetAggregationFields(Set<String> aggregationFields)This function is used to set the Set of Aggregation Fields.protected voidsetDefaultAggregationFields()protected voidsetDefaultNeededFields()voidsetNeededFields(Set<String> neededFields)This function is used to set the Set of Needed Fields to keep after aggregation.
-
-
-
Constructor Detail
-
AggregationUtility
public AggregationUtility(T t)
-
-
Method Detail
-
setDefaultAggregationFields
protected void setDefaultAggregationFields()
-
setDefaultNeededFields
protected void setDefaultNeededFields()
-
setAggregationFields
public void setAggregationFields(Set<String> aggregationFields)
This function is used to set the Set of Aggregation Fields. By default this Set if composed by Required Fields for lossless aggregation. If you want perform lossy aggregation set this Set consistently with NeededFields usingsetNeededFields(java.util.Set<java.lang.String>)- Parameters:
aggregationFields-
-
setNeededFields
public void setNeededFields(Set<String> neededFields)
This function is used to set the Set of Needed Fields to keep after aggregation. All other fields are removed. By default this Set if composed by Required Fields and AggregationField for lossless aggregation. If you want perform lossy aggregation set this Set consistently with AggregationFields usingsetAggregationFields(java.util.Set<java.lang.String>)- Parameters:
neededFields-
-
isAggregable
public boolean isAggregable(T record)
Check if the record provided as argument is aggregable with the one provided to the Constructor. This is done comparing the value of each AggregationFields- Parameters:
record- to check- Returns:
- true if the record provided as argument is aggregable with the one provided to the Constructor. False otherwise.
-
cleanExtraFields
protected void cleanExtraFields()
Remove all fields which are not in AggregationFields nor in AggregatedFields Sets
-
aggregate
public T aggregate(T record) throws NotAggregatableRecordsExceptions
- Throws:
NotAggregatableRecordsExceptions
-
-