Class HistorianUtilities

java.lang.Object
com.inductiveautomation.historian.gateway.util.HistorianUtilities

public final class HistorianUtilities extends Object
Utility class providing methods for converting, transforming, and managing Historian-related query and annotation objects. This class contains static helper methods for handling conversions between legacy and modern data formats, creating query keys, and managing threading operations for the historian system.
  • Method Details

    • toLegacyQueryParams

      public static TagHistoryQueryParams toLegacyQueryParams(DataPointQueryOptions<?> queryOptions, ResultWriterOptions writerOptions)
      Converts the given DataPointQueryOptions and ResultWriterOptions into a legacy TagHistoryQueryParams object.
      Parameters:
      queryOptions - the query options defining the time range, query keys, return size, and other configurations
      writerOptions - the writer options specifying result format and alias configurations
      Returns:
      a TagHistoryQueryParams object constructed with legacy-compatible fields based on the provided query and writer options
      Throws:
      IllegalArgumentException - if the time range is not specified in the query options
    • fromLegacyQueryFlags

      public static PropertySet fromLegacyQueryFlags(Flags flags)
      Converts legacy query flags into a PropertySet by inspecting each individual flag and mapping it to the corresponding property, if applicable.
      Parameters:
      flags - the Flags object containing the legacy flags to be converted
      Returns:
      a PropertySet containing the properties derived from the flags
    • createAggregatedQueryKeys

      public static List<AggregatedQueryKey> createAggregatedQueryKeys(TagHistoryQueryParams params)
      Generates a list of AggregatedQueryKey objects based on the provided query parameters, associating each path with its corresponding aggregation mode and a default fill mode.
      Parameters:
      params - the TagHistoryQueryParams object containing query details, including paths to query, aggregation modes, and other settings
      Returns:
      a list of AggregatedQueryKey instances, where each key represents a query configuration for an aggregated data point
    • createRawQueryKeys

      public static List<RawQueryKey> createRawQueryKeys(TagHistoryQueryParams params)
      Creates a list of RawQueryKey objects from the given TagHistoryQueryParams. Each path in the params is converted to a QualifiedPath and then used to construct a RawQueryKey.
      Parameters:
      params - the TagHistoryQueryParams containing the paths for which raw query keys are to be created
      Returns:
      a list of RawQueryKey instances corresponding to the paths in the given params
    • toLegacyAnnotation

      public static Annotation toLegacyAnnotation(AnnotationPoint point)
      Converts an AnnotationPoint object into a legacy Annotation object.
      Parameters:
      point - the AnnotationPoint object to be converted, containing the necessary information such as identifier, source, time range, data, and type.
      Returns:
      a newly created Annotation object containing the equivalent data from the provided AnnotationPoint.
    • toAnnotationPoint

      public static AnnotationPoint toAnnotationPoint(Annotation annotation)
      Converts an Annotation object to an AnnotationPoint object.
      Parameters:
      annotation - the Annotation object to be converted. Must not be null.
      Returns:
      the corresponding AnnotationPoint object built using the values from the provided annotation.
    • toAnnotationChangePoint

      public static AnnotationChangePoint toAnnotationChangePoint(Annotation annotation)
      Converts an Annotation object into an AnnotationChangePoint. The method maps the annotation's storage ID, path, range start, and state to constructs an annotation change point object.
      Parameters:
      annotation - the Annotation to convert; must not be null
      Returns:
      the corresponding AnnotationChangePoint
    • createThreadFactory

      public static ThreadFactory createThreadFactory(String name)
      Creates a new thread factory with the specified name.
      Parameters:
      name - the name to assign to the threads created by the factory
      Returns:
      a ThreadFactory configured with the given name