AnalyticsAggregationType { public static AnalyticsAggregationType fromAggregationType( AggregationType aggregationType ) { AnalyticsAggregationType analyticsAggregationType; switch ( aggregationType ) { case AVERAGE_SUM_ORG_UNIT: analyticsAggregationType = new AnalyticsAggregationType( AggregationType.SUM, AggregationType.AVERAGE ); break; case LAST: analyticsAggregationType = new AnalyticsAggregationType( AggregationType.SUM, AggregationType.LAST ); break; case LAST_AVERAGE_ORG_UNIT: analyticsAggregationType = new AnalyticsAggregationType( AggregationType.AVERAGE, AggregationType.LAST ); break; case LAST_IN_PERIOD: analyticsAggregationType = new AnalyticsAggregationType( AggregationType.SUM, AggregationType.LAST_IN_PERIOD ); break; case LAST_IN_PERIOD_AVERAGE_ORG_UNIT: analyticsAggregationType = new AnalyticsAggregationType( AggregationType.AVERAGE, AggregationType.LAST_IN_PERIOD ); break; case FIRST: analyticsAggregationType = new AnalyticsAggregationType( AggregationType.SUM, AggregationType.FIRST ); break; case FIRST_AVERAGE_ORG_UNIT: analyticsAggregationType = new AnalyticsAggregationType( AggregationType.AVERAGE, AggregationType.FIRST ); break; default: analyticsAggregationType = new AnalyticsAggregationType( aggregationType, aggregationType ); } return analyticsAggregationType; } AnalyticsAggregationType( AggregationType aggregationType, AggregationType periodAggregationType );  AnalyticsAggregationType( AggregationType aggregationType, AggregationType periodAggregationType, DataType dataType, boolean disaggregation ); AnalyticsAggregationType instance(); static AnalyticsAggregationType fromAggregationType( AggregationType aggregationType ); boolean isAggregationType( AggregationType type ); boolean isPeriodAggregationType( AggregationType type ); boolean isLastPeriodAggregationType(); boolean isFirstPeriodAggregationType(); boolean isLastInPeriodAggregationType(); boolean isFirstOrLastPeriodAggregationType(); boolean isFirstOrLastOrLastInPeriodAggregationType(); boolean isNumericDataType(); boolean isBooleanDataType(); AggregationType getAggregationType(); AggregationType getPeriodAggregationType(); DataType getDataType(); boolean isDisaggregation(); @Override String toString(); @Override boolean equals( Object object ); @Override int hashCode(); static final AnalyticsAggregationType SUM; static final AnalyticsAggregationType AVERAGE; static final AnalyticsAggregationType COUNT; static final AnalyticsAggregationType FIRST; static final AnalyticsAggregationType LAST; static final AnalyticsAggregationType LAST_IN_PERIOD; }
@Test public void verifyFromAggregationType() { assertAggregationType( fromAggregationType( AVERAGE_SUM_ORG_UNIT ), SUM, AVERAGE ); assertAggregationType( fromAggregationType( LAST ), SUM, LAST ); assertAggregationType( fromAggregationType( LAST_AVERAGE_ORG_UNIT ), AVERAGE, LAST ); assertAggregationType( fromAggregationType( FIRST ), SUM, FIRST ); assertAggregationType( fromAggregationType( FIRST_AVERAGE_ORG_UNIT ), AVERAGE, FIRST ); assertAggregationType( fromAggregationType( SUM ), SUM, SUM ); assertAggregationType( fromAggregationType( LAST_IN_PERIOD ), SUM, LAST_IN_PERIOD ); assertAggregationType( fromAggregationType( LAST_IN_PERIOD_AVERAGE_ORG_UNIT ), AVERAGE, LAST_IN_PERIOD ); }