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 Details

  • Constructor Details

    • AggregationUtility

      public AggregationUtility(T t)
  • Method Details

    • 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 using setNeededFields(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 using setAggregationFields(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