Record Class QueryBrowserSnapshot

java.lang.Object
java.lang.Record
com.inductiveautomation.ignition.designer.querybrowser.ai.QueryBrowserSnapshot
Record Components:
query - the current text in the SQL 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, or an empty string when no datasource is selected and the project has no default.
vendor - the vendor of the selected datasource, or null when no datasource is selected, the vendor lookup hasn't completed, or the datasource is not recognized.
queryType - the declared query type (AutoDetect, Select, Update).
datasources - all the datasources that are currently available to the user from the Gateway.
rowLimit - the row-limit value at submit time when the limit checkbox is on, or 0 when the checkbox is off or the query type is not Select. Informational only — the runtime applies the limit; the agent uses this to caveat its suggestions.

public record QueryBrowserSnapshot(String query, int caretPosition, String selectedText, String datasourceName, @Nullable DatabaseVendor vendor, SQLQueryType queryType, List<String> datasources, int rowLimit) extends Record
Frozen view of the Query Browser editor at the moment the user submits an AI prompt. The composer reads these fields directly into the wire format described in QueryBrowserAgent; keeping the snapshot type narrow makes the composer/agent contract easier to reason about than passing the live panel around.
  • Constructor Details

    • QueryBrowserSnapshot

      public QueryBrowserSnapshot(String query, int caretPosition, String selectedText, String datasourceName, @Nullable DatabaseVendor vendor, SQLQueryType queryType, List<String> datasources, int rowLimit)
      Creates an instance of a QueryBrowserSnapshot record class.
      Parameters:
      query - the value for the query record component
      caretPosition - the value for the caretPosition record component
      selectedText - the value for the selectedText record component
      datasourceName - the value for the datasourceName record component
      vendor - the value for the vendor record component
      queryType - the value for the queryType record component
      datasources - the value for the datasources record component
      rowLimit - the value for the rowLimit record component
  • Method Details

    • hasDatasource

      public boolean hasDatasource()
      Returns:
      true when a concrete datasource is selected (either explicitly or via the project default). When false the agent has no connection to ground its schema lookups against and should ask the user to pick one.
    • 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 SQLQueryType queryType()
      Returns the value of the queryType record component.
      Returns:
      the value of the queryType record component
    • datasources

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

      public int rowLimit()
      Returns the value of the rowLimit record component.
      Returns:
      the value of the rowLimit record component