Class AbstractQueryOptions.BaseBuilder<K extends QueryKey<T>,T extends TemporalPointType & QueryablePointType<T>,B extends AbstractQueryOptions.BaseBuilder<K,T,B>>
java.lang.Object
com.inductiveautomation.historian.common.model.options.AbstractQueryOptions.BaseBuilder<K,T,B>
- Type Parameters:
K
- The type of the query key, extendingQueryKey
.T
- The type of the temporal point, extendingTemporalPointType
andQueryablePointType
.B
- The type of the builder itself.
- Direct Known Subclasses:
AnnotationQueryOptions.Builder
,DataPointQueryOptions.DataQueryBuilder
,MetadataQueryOptions.Builder
- Enclosing class:
- AbstractQueryOptions<K extends QueryKey<T>,
T extends TemporalPointType & QueryablePointType<T>>
public abstract static class AbstractQueryOptions.BaseBuilder<K extends QueryKey<T>,T extends TemporalPointType & QueryablePointType<T>,B extends AbstractQueryOptions.BaseBuilder<K,T,B>>
extends Object
Abstract base class for building
AbstractQueryOptions
.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Default constructor for the builder.protected
BaseBuilder
(AbstractQueryOptions<K, T> options) Constructs a builder from an existingAbstractQueryOptions
. -
Method Summary
Modifier and TypeMethodDescription<V> B
addPropertyValue
(Property<V> property, V value) Adds a property value to the extended properties of the query.addPropertyValues
(PropertySet properties) Adds multiple property values to the extended properties of the query.addQueryKey
(K key) Adds a query key to the list of query keys.addQueryKeys
(Collection<K> keys) Adds multiple query keys to the list of query keys.abstract AbstractQueryOptions<K,
T> build()
Builds theAbstractQueryOptions
instance.protected TimeRange
Calculates the time range for the query based on the start time, end time, and range.Clears all query keys from the list.endTime
(long endTime) Sets the end time for the query using a timestamp in milliseconds.Sets the end time for the query.Excludes bounds from the time range for the query.Includes bounds in the time range for the query.rangeHours
(int hours) Adds a duration in hours to the time range for the query.rangeMinutes
(int minutes) Adds a duration in minutes to the time range for the query.rangeSeconds
(int seconds) Adds a duration in seconds to the time range for the query.returnSize
(Integer returnSize) Sets the maximum number of results to return for the query.protected abstract B
self()
Returns the current builder instance.startTime
(long startTime) Sets the start time for the query using a timestamp in milliseconds.Sets the start time for the query.
-
Field Details
-
returnSize
-
-
Constructor Details
-
BaseBuilder
protected BaseBuilder()Default constructor for the builder. -
BaseBuilder
Constructs a builder from an existingAbstractQueryOptions
.- Parameters:
options
- The existing query options to copy.
-
-
Method Details
-
includeBounds
Includes bounds in the time range for the query.- Returns:
- The current builder instance.
-
excludeBounds
Excludes bounds from the time range for the query.- Returns:
- The current builder instance.
-
startTime
Sets the start time for the query.- Parameters:
startTime
- The start time as anInstant
, or null to unset.- Returns:
- The current builder instance.
-
startTime
Sets the start time for the query using a timestamp in milliseconds.- Parameters:
startTime
- The start time in milliseconds since the epoch.- Returns:
- The current builder instance.
-
endTime
Sets the end time for the query.- Parameters:
endTime
- The end time as anInstant
, or null to unset.- Returns:
- The current builder instance.
-
endTime
Sets the end time for the query using a timestamp in milliseconds.- Parameters:
endTime
- The end time in milliseconds since the epoch.- Returns:
- The current builder instance.
-
rangeHours
Adds a duration in hours to the time range for the query.- Parameters:
hours
- The number of hours to add.- Returns:
- The current builder instance.
-
rangeMinutes
Adds a duration in minutes to the time range for the query.- Parameters:
minutes
- The number of minutes to add.- Returns:
- The current builder instance.
-
rangeSeconds
Adds a duration in seconds to the time range for the query.- Parameters:
seconds
- The number of seconds to add.- Returns:
- The current builder instance.
-
returnSize
Sets the maximum number of results to return for the query.- Parameters:
returnSize
- The maximum number of results, or null to unset.- Returns:
- The current builder instance.
-
addPropertyValue
Adds a property value to the extended properties of the query.- Type Parameters:
V
- The type of the property value.- Parameters:
property
- The property to add.value
- The value of the property.- Returns:
- The current builder instance.
-
addPropertyValues
Adds multiple property values to the extended properties of the query.- Parameters:
properties
- The set of properties to add.- Returns:
- The current builder instance.
-
addQueryKey
Adds a query key to the list of query keys.- Parameters:
key
- The query key to add.- Returns:
- The current builder instance.
-
addQueryKeys
Adds multiple query keys to the list of query keys.- Parameters:
keys
- The collection of query keys to add.- Returns:
- The current builder instance.
-
clearQueryKeys
Clears all query keys from the list.- Returns:
- The current builder instance.
-
self
Returns the current builder instance.- Returns:
- The current builder instance.
-
build
Builds theAbstractQueryOptions
instance.- Returns:
- A new
AbstractQueryOptions
instance.
-
calculateTimeRange
Calculates the time range for the query based on the start time, end time, and range.- Returns:
- The calculated
TimeRange
, or null if no valid range can be determined. - Throws:
IllegalArgumentException
- If the end time is set without a start time or range.
-