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 intoqueryat submit time.selectedText- highlighted substring, or an empty string when nothing is selected.datasourceName- the selected datasource name; equalsNamedQuery.DATABASE_PARAM_OPTION("{}") when the user has chosen the Parameter option, in which casevendorwill benull.vendor- the vendor of the selected datasource, ornullwhen 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 Summary
ConstructorsConstructorDescriptionNamedQuerySnapshot(String query, int caretPosition, String selectedText, String datasourceName, @Nullable DatabaseVendor vendor, NamedQuery.Type queryType, List<NamedQuery.Parameter> parameters, List<String> datasources) Creates an instance of aNamedQuerySnapshotrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thecaretPositionrecord component.Returns the value of thedatasourceNamerecord component.Returns the value of thedatasourcesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theparametersrecord component.query()Returns the value of thequeryrecord component.Returns the value of thequeryTyperecord component.Returns the value of theselectedTextrecord component.final StringtoString()Returns a string representation of this record class.@Nullable DatabaseVendorvendor()Returns the value of thevendorrecord component.
-
Constructor Details
-
NamedQuerySnapshot
public NamedQuerySnapshot(String query, int caretPosition, String selectedText, String datasourceName, @Nullable DatabaseVendor vendor, NamedQuery.Type queryType, List<NamedQuery.Parameter> parameters, List<String> datasources) Creates an instance of aNamedQuerySnapshotrecord class.- Parameters:
query- the value for thequeryrecord componentcaretPosition- the value for thecaretPositionrecord componentselectedText- the value for theselectedTextrecord componentdatasourceName- the value for thedatasourceNamerecord componentvendor- the value for thevendorrecord componentqueryType- the value for thequeryTyperecord componentparameters- the value for theparametersrecord componentdatasources- the value for thedatasourcesrecord component
-
-
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
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
query
-
caretPosition
public int caretPosition()Returns the value of thecaretPositionrecord component.- Returns:
- the value of the
caretPositionrecord component
-
selectedText
Returns the value of theselectedTextrecord component.- Returns:
- the value of the
selectedTextrecord component
-
datasourceName
Returns the value of thedatasourceNamerecord component.- Returns:
- the value of the
datasourceNamerecord component
-
vendor
-
queryType
-
parameters
Returns the value of theparametersrecord component.- Returns:
- the value of the
parametersrecord component
-
datasources
Returns the value of thedatasourcesrecord component.- Returns:
- the value of the
datasourcesrecord component
-