class QueryPlannerUtils {

    public static boolean isDisaggregation( AnalyticsAggregationType aggregationType, PeriodType aggregationPeriodType, PeriodType dataPeriodType )
    {
        if ( dataPeriodType == null || aggregationPeriodType == null )
        {
            return false;
        }

        if ( aggregationType == null || AggregationType.AVERAGE != aggregationType.getPeriodAggregationType() )
        {
            return false;
        }

        if ( aggregationPeriodType.getFrequencyOrder() < dataPeriodType.getFrequencyOrder() )
        {
            return true;
        }

        if ( aggregationPeriodType.getFrequencyOrder() == dataPeriodType.getFrequencyOrder() &&
            !aggregationPeriodType.equals( dataPeriodType ) )
        {
            return true;
        }

        return false;
    }

}