Record Class NamedQuerySnapshot

java.lang.Object
java.lang.Record
com.inductiveautomation.ignition.designer.db.namedquery.workspace.ai.NamedQuerySnapshot
Record Components:
query - the current SQL in the editor; may be empty.
caretPosition - caret offset into query at submit time.
selectedText - highlighted substring, or an empty string when nothing is selected.
datasourceName - the selected datasource name; equals NamedQuery.DATABASE_PARAM_OPTION ("{}") when the user has chosen the Parameter option, in which case vendor will be null.
vendor - the vendor of the selected datasource, or null when the datasource is the Parameter option, the lookup hasn't completed, or the datasource is not recognized.
queryType - the declared query type (Query, ScalarQuery, UpdateQuery).
parameters - the parameter table contents at submit time, excluding the hidden Database parameter row.
datasources - all the datasources that are currently available to the user from the Gateway.

public record NamedQuerySnapshot(String query, int caretPosition, String selectedText, String datasourceName, @Nullable DatabaseVendor vendor, NamedQuery.Type queryType, List<NamedQuery.Parameter> parameters, List<String> datasources) extends Record
Frozen view of the Named Query authoring panel taken at the moment the user submits a prompt. The renderer-side composer reads these fields directly into the wire format described in NamedQueryAgent; keeping the snapshot type narrow makes the composer/agent contract easier to reason about than passing the live panel around.
  • Constructor Details

  • Method Details

    • isParameterDatasource

      public boolean isParameterDatasource()
      Returns:
      true when the user has set the datasource to the special "{}" Parameter option, meaning the database is supplied at runtime and the agent has no schema to draw on.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • query

      public String query()
      Returns the value of the query record component.
      Returns:
      the value of the query record component
    • caretPosition

      public int caretPosition()
      Returns the value of the caretPosition record component.
      Returns:
      the value of the caretPosition record component
    • selectedText

      public String selectedText()
      Returns the value of the selectedText record component.
      Returns:
      the value of the selectedText record component
    • datasourceName

      public String datasourceName()
      Returns the value of the datasourceName record component.
      Returns:
      the value of the datasourceName record component
    • vendor

      public @Nullable DatabaseVendor vendor()
      Returns the value of the vendor record component.
      Returns:
      the value of the vendor record component
    • queryType

      public NamedQuery.Type queryType()
      Returns the value of the queryType record component.
      Returns:
      the value of the queryType record component
    • parameters

      public List<NamedQuery.Parameter> parameters()
      Returns the value of the parameters record component.
      Returns:
      the value of the parameters record component
    • datasources

      public List<String> datasources()
      Returns the value of the datasources record component.
      Returns:
      the value of the datasources record component