Class NamedQueryReplyRenderer

java.lang.Object
com.inductiveautomation.ignition.designer.db.namedquery.workspace.ai.NamedQueryReplyRenderer
All Implemented Interfaces:
ReplyRenderer

public final class NamedQueryReplyRenderer extends Object implements ReplyRenderer
Renders NamedQueryAgent replies into a Swing view with an Apply button that writes the suggestion back to the host panel. The harness delivers replies as ResponseEnvelope — a Statement envelope (clarifying question or explanation) renders as prose only; a Suggestion envelope's value field is the structured JSON payload this renderer parses:
{
  "sql": "<proposed query>",
  "parameterChanges": {
    "remove": ["unusedParam"],
    "add": [{ "name": "...", "kind": "Parameter", "dataType": "Int4" }]
  }
}

Both top-level fields are optional. A Suggestion whose payload validates empty (no SQL, no mutations) renders without an Apply button.

Validation is local to this class: malformed JSON in value drops the whole payload with a warning; individual malformed add entries inside a valid payload are listed under a "Skipped" subsection so the user can spot what they need to do manually.

  • Constructor Details

  • Method Details

    • renderStatement

      public ReplyView renderStatement(String description)
      Description copied from interface: ReplyRenderer
      Render an informational reply with no apply-able actions. The returned ReplyView is expected to carry an empty actions list — the panel will read it as a STATEMENT card.
      Specified by:
      renderStatement in interface ReplyRenderer
      Parameters:
      description - prose explanation from the model, supporting markdown.
    • getSuggestionFailure

      public @Nullable String getSuggestionFailure(String value)
      Description copied from interface: ReplyRenderer
      Check an apply-able payload before anything renders it. A renderer that rejects a payload here gets the model asked again while the turn is still open, instead of the user reading a rejection card for a reply nothing tried to fix.

      Unlike the render methods this runs on the sending thread, not the EDT, so an implementation must inspect only value — no Swing state, no editor snapshot.

      Specified by:
      getSuggestionFailure in interface ReplyRenderer
      Parameters:
      value - the payload ReplyRenderer.renderSuggestion(String, String) would receive.
      Returns:
      null when the payload is usable. Otherwise what to tell the model, phrased for it to act on: what was wrong and what to send instead.
    • renderSuggestion

      public ReplyView renderSuggestion(String description, String value)
      Description copied from interface: ReplyRenderer
      Render an apply-able suggestion. The value is the literal content the user can write back to the host editor; description is the prose framing. The returned view typically carries one or more apply buttons (Insert, Replace, …).
      Specified by:
      renderSuggestion in interface ReplyRenderer
      Parameters:
      description - prose explanation from the model, supporting markdown.
      value - the literal content the apply buttons hand back to the host editor.