Class HistorianUtilities
java.lang.Object
com.inductiveautomation.historian.gateway.util.HistorianUtilities
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 Summary
Modifier and TypeMethodDescriptionstatic List<AggregatedQueryKey>Generates a list ofAggregatedQueryKeyobjects based on the provided query parameters, associating each path with its corresponding aggregation mode and a default fill mode.static List<RawQueryKey>Creates a list ofRawQueryKeyobjects from the givenTagHistoryQueryParams.static ThreadFactorycreateThreadFactory(String name) Creates a new thread factory with the specified name.static PropertySetfromLegacyQueryFlags(Flags flags) Converts legacy query flags into aPropertySetby inspecting each individual flag and mapping it to the corresponding property, if applicable.static AnnotationChangePointtoAnnotationChangePoint(Annotation annotation) Converts anAnnotationobject into anAnnotationChangePoint.static AnnotationPointtoAnnotationPoint(Annotation annotation) Converts an Annotation object to an AnnotationPoint object.static AnnotationConverts an AnnotationPoint object into a legacy Annotation object.static TagHistoryQueryParamstoLegacyQueryParams(DataPointQueryOptions<?> queryOptions, ResultWriterOptions writerOptions) Converts the given DataPointQueryOptions and ResultWriterOptions into a legacy TagHistoryQueryParams object.
-
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 configurationswriterOptions- 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
Converts legacy query flags into aPropertySetby inspecting each individual flag and mapping it to the corresponding property, if applicable.- Parameters:
flags- theFlagsobject containing the legacy flags to be converted- Returns:
- a
PropertySetcontaining the properties derived from the flags
-
createAggregatedQueryKeys
Generates a list ofAggregatedQueryKeyobjects based on the provided query parameters, associating each path with its corresponding aggregation mode and a default fill mode.- Parameters:
params- theTagHistoryQueryParamsobject containing query details, including paths to query, aggregation modes, and other settings- Returns:
- a list of
AggregatedQueryKeyinstances, where each key represents a query configuration for an aggregated data point
-
createRawQueryKeys
Creates a list ofRawQueryKeyobjects from the givenTagHistoryQueryParams. Each path in theparamsis converted to aQualifiedPathand then used to construct aRawQueryKey.- Parameters:
params- theTagHistoryQueryParamscontaining the paths for which raw query keys are to be created- Returns:
- a list of
RawQueryKeyinstances corresponding to the paths in the givenparams
-
toLegacyAnnotation
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
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
Converts anAnnotationobject into anAnnotationChangePoint. The method maps the annotation's storage ID, path, range start, and state to constructs an annotation change point object.- Parameters:
annotation- theAnnotationto convert; must not be null- Returns:
- the corresponding
AnnotationChangePoint
-
createThreadFactory
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
-