private void validateTimeSeriesMetric ( DateTime from , DateTime to , HistogramIntervalType interval ) throws InvalidMetricCriteriaException { long millis = to . getMillis ( ) - from . getMillis ( ) ; long divBy = ONE_DAY_MILLIS ; switch ( interval ) { case day : divBy = ONE_DAY_MILLIS ; break ; case hour : divBy = ONE_HOUR_MILLIS ; break ; case minute : divBy = ONE_MINUTE_MILLIS ; break ; case month : divBy = ONE_MONTH_MILLIS ; break ; case week : divBy = ONE_WEEK_MILLIS ; break ; default : break ; } long totalDataPoints = millis / divBy ; if ( totalDataPoints > 5000 ) { throw ExceptionFactory . invalidMetricCriteriaException ( Messages . i18n . format ( "OrganizationResourceImpl.MetricDataSetTooLarge" ) ) ; //$NON-NLS-1$ } }
Ensures that a time series can be created for the given date range and interval and that the