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, extending QueryKey.
T - The type of the temporal point, extending TemporalPointType and QueryablePointType.
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 Details

    • returnSize

      @Nullable protected Integer returnSize
  • Constructor Details

    • BaseBuilder

      protected BaseBuilder()
      Default constructor for the builder.
    • BaseBuilder

      protected BaseBuilder(AbstractQueryOptions<K,T> options)
      Constructs a builder from an existing AbstractQueryOptions.
      Parameters:
      options - The existing query options to copy.
  • Method Details

    • includeBounds

      public B includeBounds()
      Includes bounds in the time range for the query.
      Returns:
      The current builder instance.
    • excludeBounds

      public B excludeBounds()
      Excludes bounds from the time range for the query.
      Returns:
      The current builder instance.
    • startTime

      public B startTime(@Nullable Instant startTime)
      Sets the start time for the query.
      Parameters:
      startTime - The start time as an Instant, or null to unset.
      Returns:
      The current builder instance.
    • startTime

      public B startTime(long 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

      public B endTime(@Nullable Instant endTime)
      Sets the end time for the query.
      Parameters:
      endTime - The end time as an Instant, or null to unset.
      Returns:
      The current builder instance.
    • endTime

      public B endTime(long 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

      public B rangeHours(int hours)
      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

      public B rangeMinutes(int minutes)
      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

      public B rangeSeconds(int seconds)
      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

      public B returnSize(@Nullable Integer 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

      public <V> B addPropertyValue(Property<V> property, V value)
      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

      public B addPropertyValues(PropertySet properties)
      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

      public B addQueryKey(K key)
      Adds a query key to the list of query keys.
      Parameters:
      key - The query key to add.
      Returns:
      The current builder instance.
    • addQueryKeys

      public B addQueryKeys(Collection<K> keys)
      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

      public B clearQueryKeys()
      Clears all query keys from the list.
      Returns:
      The current builder instance.
    • self

      protected abstract B self()
      Returns the current builder instance.
      Returns:
      The current builder instance.
    • build

      public abstract AbstractQueryOptions<K,T> build()
      Builds the AbstractQueryOptions instance.
      Returns:
      A new AbstractQueryOptions instance.
    • calculateTimeRange

      @Nullable protected TimeRange 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.