Class ResultWriterOptions
java.lang.Object
com.inductiveautomation.historian.common.model.options.ResultWriterOptions
Options for how query results are written: object type, result format, JSON shape and column
naming.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder forResultWriterOptions.final classNames one schema's columns: the caller's column name for a key's position (onceresolveColumnNames(List)has run), otherwise the header alias for its full source path, otherwise the path.static enumThe kind of object a query returns.static enumHow the data is laid out in the result. -
Method Summary
Modifier and TypeMethodDescriptionstatic ResultWriterOptions.Builderbuilder()Creates a builder.columnNamer(Collection<? extends DataPointQueryKey> keys) Starts naming the columns of one result schema.columnNamer(Collection<? extends DataPointQueryKey> keys, boolean suffixClashes) Starts naming one schema's columns, optionally without the" [<aggregate id>]"suffix that keeps a path's per-aggregate columns distinct.Returns the column names by query-key position, as supplied (for example a script'scolumnNames).Returns the header aliases, with keys lowercased.getHeaderAliasOrDefault(String header, String defaultValue) Returns the alias for a header, matching case-insensitively.Returns the JSON output shape; only meaningful forResultWriterOptions.ObjectType.JSON, andJsonOutputShape.NDJSONby default.Returns the format of the result.Returns the object type of the result.static StringparameterText(AggregateSpec spec) Returns an aggregate's parameters asname=valuepairs, such asp=0.5.resolveColumnNames(List<? extends DataPointQueryKey> queryKeys) Returns a copy whosecolumnNamer(Collection)pairs each query key with the column name at its position.
-
Method Details
-
getResultObjectType
Returns the object type of the result.- Returns:
- the object type.
-
getResultFormat
Returns the format of the result.- Returns:
- the result format.
-
getJsonOutputShape
Returns the JSON output shape; only meaningful forResultWriterOptions.ObjectType.JSON, andJsonOutputShape.NDJSONby default.- Returns:
- the shape.
-
getHeaderAliasMap
Returns the header aliases, with keys lowercased. PrefergetHeaderAliasOrDefault(String, String)for lookups.- Returns:
- the aliases, or an empty map if none.
-
getHeaderAliasOrDefault
-
getColumnNames
Returns the column names by query-key position, as supplied (for example a script'scolumnNames). UnlikegetHeaderAliasMap(), these distinguish two keys that share a path, such as one tag queried with several aggregates.- Returns:
- the names, empty if none were given; entries may be
null.
-
resolveColumnNames
Returns a copy whosecolumnNamer(Collection)pairs each query key with the column name at its position. A repeated key keeps the name given at each position.- Parameters:
queryKeys- the query's keys, in the order the column names were given.- Returns:
- this instance if there are no positional names or they are already resolved, otherwise a resolved copy.
-
columnNamer
Starts naming the columns of one result schema. Ask the namer for each key in schema order.- Parameters:
keys- every key the schema will name.- Returns:
- a new namer; not thread-safe.
-
columnNamer
public ResultWriterOptions.ColumnNamer columnNamer(Collection<? extends DataPointQueryKey> keys, boolean suffixClashes) Starts naming one schema's columns, optionally without the" [<aggregate id>]"suffix that keeps a path's per-aggregate columns distinct.- Parameters:
keys- every key the schema will name.suffixClashes- whether a default name for a path queried with several aggregates ends in the aggregate id, and its parameters when the path lists the id under several.- Returns:
- a new namer; not thread-safe.
-
parameterText
Returns an aggregate's parameters asname=valuepairs, such asp=0.5.- Parameters:
spec- the aggregate.- Returns:
- the parameter text; empty for an unparameterized aggregate.
-
builder
-