Class ResultWriterOptions

java.lang.Object
com.inductiveautomation.historian.common.model.options.ResultWriterOptions

public class ResultWriterOptions extends Object
Options for how query results are written: object type, result format, JSON shape and column naming.
  • Method Details

    • getResultObjectType

      public ResultWriterOptions.ObjectType getResultObjectType()
      Returns the object type of the result.
      Returns:
      the object type.
    • getResultFormat

      public ResultWriterOptions.ResultFormat getResultFormat()
      Returns the format of the result.
      Returns:
      the result format.
    • getJsonOutputShape

      public JsonOutputShape getJsonOutputShape()
      Returns the JSON output shape; only meaningful for ResultWriterOptions.ObjectType.JSON, and JsonOutputShape.NDJSON by default.
      Returns:
      the shape.
    • getHeaderAliasMap

      public Map<String,String> getHeaderAliasMap()
      Returns the header aliases, with keys lowercased. Prefer getHeaderAliasOrDefault(String, String) for lookups.
      Returns:
      the aliases, or an empty map if none.
    • getHeaderAliasOrDefault

      public String getHeaderAliasOrDefault(String header, String defaultValue)
      Returns the alias for a header, matching case-insensitively.
      Parameters:
      header - the header name.
      defaultValue - the value to return if there is no alias.
      Returns:
      the alias, or defaultValue.
    • getColumnNames

      public List<String> getColumnNames()
      Returns the column names by query-key position, as supplied (for example a script's columnNames). Unlike getHeaderAliasMap(), 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

      public ResultWriterOptions resolveColumnNames(List<? extends DataPointQueryKey> queryKeys)
      Returns a copy whose columnNamer(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

      public ResultWriterOptions.ColumnNamer columnNamer(Collection<? extends DataPointQueryKey> keys)
      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

      public static String parameterText(AggregateSpec spec)
      Returns an aggregate's parameters as name=value pairs, such as p=0.5.
      Parameters:
      spec - the aggregate.
      Returns:
      the parameter text; empty for an unparameterized aggregate.
    • builder

      public static ResultWriterOptions.Builder builder()
      Creates a builder.
      Returns:
      a new builder.