Class LlmDataQuerySerializer
DataSet.getLlmGeneratedQuery().
A document says what the query text declares and nothing about the run that will execute it: an
LlmQueryParameter carries no value, and what it says about the run offering it — multi-valued,
optional — is transient and stays out of the document. One stored query therefore serves every run.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.google.gson.GsonHTML escaping is off: a query is full of>,<and=, which Gson escapes by default, writing them as unicode escapes into the document the report XML carries.protected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionassemble(String jpql, List<String> resultProperties, @Nullable LlmDataQuery previous) Assembles the document of a query edited by hand out of its text and its columns.@Nullable LlmDataQueryReads a stored query back.protected List<LlmQueryParameter> retainNamedParameters(@Nullable List<LlmQueryParameter> parameters) Keeps the parameters that can actually be bound — a stored parameter without a name is useless — and gives one whose type the document omitted an empty type rather than none, which the constructor rejects.protected <T> List<T> retainNonNull(@Nullable List<T> values) toJson(LlmDataQuery query)
-
Field Details
-
REGENERATE_HINT
- See Also:
-
gson
protected final com.google.gson.Gson gsonHTML escaping is off: a query is full of>,<and=, which Gson escapes by default, writing them as unicode escapes into the document the report XML carries. Nothing reads them that way except the people looking at an exported report or at its diff.
-
-
Constructor Details
-
LlmDataQuerySerializer
public LlmDataQuerySerializer()
-
-
Method Details
-
toJson
- Parameters:
query- query to store- Returns:
- the query as a JSON document
-
fromJson
Reads a stored query back.- Parameters:
json- stored document, ornull- Returns:
- the query, or
nullif nothing is stored yet - Throws:
LlmDataQueryException- if the document cannot be read or carries no query text
-
retainNonNull
-
retainNamedParameters
protected List<LlmQueryParameter> retainNamedParameters(@Nullable List<LlmQueryParameter> parameters) Keeps the parameters that can actually be bound — a stored parameter without a name is useless — and gives one whose type the document omitted an empty type rather than none, which the constructor rejects. -
assemble
public LlmDataQuery assemble(String jpql, List<String> resultProperties, @Nullable LlmDataQuery previous) Assembles the document of a query edited by hand out of its text and its columns.The parameters are not edited but re-derived from the text the way the add-on validates queries by (
LlmQueryParameterNames.referencedIn(java.lang.String)), so a hand-written:nameis declared by the act of writing it and a removed one disappears; a parameter the previous document declared keeps its Java type, and one that appears with the edit has none to keep — the loader types every argument from the run's own dictionary anyway. The explanation and the warnings of the query being replaced are carried over: they describe what the model produced, and an edit does not make them false, only incomplete.- Parameters:
jpql- query text as editedresultProperties- column names in select-clause orderprevious- query being replaced, ornullif there is none- Returns:
- the assembled query, ready to be stored with
toJson(LlmDataQuery)
-