Package io.jmix.reports.llm
Class LlmQueryParameterNames
java.lang.Object
io.jmix.reports.llm.LlmQueryParameterNames
Names under which an LLM data query may reference the values around it.
The rules live here because two sides must agree on them: the report designer tells query generation which names exist, and the loader binds values under the very same names at run time. A name invented on one side and not recognised on the other would fail the report instead of filtering a band.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisCrossTabAxis(String name) Tells an axis of a cross-tab band from an ordinary run parameter by the suffixCrossTabExtractionControllerrecognises its data sets by.static booleanisCrossTabAxisOf(String name, String bandName) Returns whether this is the name of an axis of that very band.static booleanstatic StringofBandField(String bandName, String fieldName) Returns the name a field of a parent band row is referenced by.static StringofCrossTabAxisPrefix(String dataSetName) Returns what every name of one cross-tab axis starts with.static StringofCrossTabValue(String dataSetName, String fieldName) Returns the name the values of one cross-tab axis field are referenced by.referencedIn(String jpql) Returns the parameters a query text references, in the order it references them.static StringstripStringLiterals(String jpql) Blanks out the string literals of a query, so thatlike 'urn:isbn%'references no parameter namedisbn— one nothing could ever bind.
-
Method Details
-
ofBandField
Returns the name a field of a parent band row is referenced by. SQL and JPQL data sets use${Band.field}, but a JPQL parameter name cannot contain a dot, so the name is flattened.- Parameters:
bandName- name of the band the field belongs tofieldName- name of the field within that band's row- Returns:
- the parameter name, which still has to be checked with
isValid(String)
-
ofCrossTabValue
Returns the name the values of one cross-tab axis field are referenced by. The form matches whatSqlCrosstabPreprocessorproduces out of the<dataSet>@<field>reference SQL and JPQL data sets use, so the same query reads the same for either type.- Parameters:
dataSetName- name of the axis data set, i.e.<band>_dynamic_headeror<band>_master_datafieldName- name of the field within that axis' rows- Returns:
- the parameter name, which still has to be checked with
isValid(String)
-
ofCrossTabAxisPrefix
Returns what every name of one cross-tab axis starts with.CrossTabExtractionControllerlinks a cell to its axis by the first result column starting with the axis data set's name, so both sides of the seam — the loader that builds the dictionary from real rows and the designer that builds one from stored queries — decide by this prefix which axis a name belongs to.- Parameters:
dataSetName- name of the axis data set- Returns:
- the prefix the axis's names share
-
isCrossTabAxis
Tells an axis of a cross-tab band from an ordinary run parameter by the suffixCrossTabExtractionControllerrecognises its data sets by.- Parameters:
name- name of a run parameter, which for an axis is the axis data set's own name- Returns:
trueif the parameter holds the rows of a cross-tab axis
-
isCrossTabAxisOf
Returns whether this is the name of an axis of that very band. Compared whole: a band namedrevenuewould otherwise recogniserevenue_extra_master_data— the axis of a band namedrevenue_extra— as its own.- Parameters:
name- candidate axis namebandName- name of the band the axis would belong to
-
referencedIn
Returns the parameters a query text references, in the order it references them. This is what a query declares by being written, and what the parameters of a stored document are derived from every time a query is stored. It must read a query the same way the add-on's validator does (JpqlValidatorSupport.referencedParameters), so a document the designer wrote and a document the designer validated agree; a parity test enforces that. It lives here, rather than delegating to the add-on, so the derivation still works when the add-on is absent.- Parameters:
jpql- query text- Returns:
- names of the referenced parameters
-
stripStringLiterals
Blanks out the string literals of a query, so thatlike 'urn:isbn%'references no parameter namedisbn— one nothing could ever bind. Every literal is replaced by spaces of the same length to leave the rest of the text where it was.- Parameters:
jpql- query text- Returns:
- the same text with the content of its literals blanked out
-
isValid
- Parameters:
name- candidate parameter name- Returns:
trueif a generated query can reference this name
-