Class AggregatedQueryOptions.Builder
java.lang.Object
com.inductiveautomation.historian.common.model.options.AbstractQueryOptions.BaseBuilder<K,DataPointType,B>
com.inductiveautomation.historian.common.model.options.DataPointQueryOptions.DataQueryBuilder<AggregatedQueryKey,AggregatedQueryOptions.Builder>
com.inductiveautomation.historian.common.model.options.AggregatedQueryOptions.Builder
- Enclosing class:
- AggregatedQueryOptions
public static class AggregatedQueryOptions.Builder
extends DataPointQueryOptions.DataQueryBuilder<AggregatedQueryKey,AggregatedQueryOptions.Builder>
Builder class for constructing instances of
AggregatedQueryOptions
.
This class provides methods to configure the time window for aggregation
and other related options. It extends DataPointQueryOptions.DataQueryBuilder
to inherit
common query-building functionality.
-
Field Summary
Fields inherited from class com.inductiveautomation.historian.common.model.options.DataPointQueryOptions.DataQueryBuilder
excludeObservations, levelBuilder
Fields inherited from class com.inductiveautomation.historian.common.model.options.AbstractQueryOptions.BaseBuilder
returnSize
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds and returns a newAggregatedQueryOptions
instance.protected AggregatedQueryOptions.Builder
self()
Returns the current builder instance.withDayWindows
(long days) Configures the time window to use day-based windows.withHourWindows
(long hours) Configures the time window to use hour-based windows.withMinuteWindows
(long minutes) Configures the time window to use minute-based windows.withMonthWindows
(long months) Configures the time window to use month-based windows.withTimeWindow
(TimeWindow window) Sets the time window for the aggregation.withWeekWindows
(long weeks) Configures the time window to use week-based windows.withWindowSize
(long size, ChronoUnit unit) Sets the time window size and unit for the aggregation.withYearWindows
(long years) Configures the time window to use year-based windows.Methods inherited from class com.inductiveautomation.historian.common.model.options.DataPointQueryOptions.DataQueryBuilder
addQualityLevel, applyQualityLevelMask, excludeObservations, includeAllQuality, includeBadQuality, includeErrorQuality, includeGoodQuality, includeUncertainQuality
Methods inherited from class com.inductiveautomation.historian.common.model.options.AbstractQueryOptions.BaseBuilder
addPropertyValue, addPropertyValues, addQueryKey, addQueryKeys, calculateTimeRange, clearQueryKeys, endTime, endTime, excludeBounds, includeBounds, rangeHours, rangeMinutes, rangeSeconds, returnSize, startTime, startTime
-
Method Details
-
withTimeWindow
Sets the time window for the aggregation.- Parameters:
window
- TheTimeWindow
to use.- Returns:
- The current builder instance.
-
withWindowSize
Sets the time window size and unit for the aggregation.- Parameters:
size
- The size of the time window.unit
- TheChronoUnit
representing the unit of time.- Returns:
- The current builder instance.
-
withHourWindows
Configures the time window to use hour-based windows.- Parameters:
hours
- The number of hours per window.- Returns:
- The current builder instance.
-
withMinuteWindows
Configures the time window to use minute-based windows.- Parameters:
minutes
- The number of minutes per window.- Returns:
- The current builder instance.
-
withDayWindows
Configures the time window to use day-based windows.- Parameters:
days
- The number of days per window.- Returns:
- The current builder instance.
-
withWeekWindows
Configures the time window to use week-based windows.- Parameters:
weeks
- The number of weeks per window.- Returns:
- The current builder instance.
-
withMonthWindows
Configures the time window to use month-based windows.- Parameters:
months
- The number of months per window.- Returns:
- The current builder instance.
-
withYearWindows
Configures the time window to use year-based windows.- Parameters:
years
- The number of years per window.- Returns:
- The current builder instance.
-
self
Returns the current builder instance.- Specified by:
self
in classAbstractQueryOptions.BaseBuilder<AggregatedQueryKey,
DataPointType, AggregatedQueryOptions.Builder> - Returns:
- The current builder instance.
-
build
Builds and returns a newAggregatedQueryOptions
instance.If no explicit time window is set, it attempts to calculate one based on the return size and time range.
- Specified by:
build
in classAbstractQueryOptions.BaseBuilder<AggregatedQueryKey,
DataPointType, AggregatedQueryOptions.Builder> - Returns:
- A new
AggregatedQueryOptions
instance. - Throws:
IllegalStateException
- If the time range or return size is not set.
-