Package io.jmix.aitools.dataload
Class EntityDataLoadResult
java.lang.Object
io.jmix.aitools.dataload.EntityDataLoadResult
Outcome of
AiDataLoadService.loadData(String): the original user request together
with the LLM-generated query, its validation result and the fetched rows.
Always returned - inspect isExecuted() and getExecutionError() to tell
a successful load from a generation/validation/execution failure.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected @Nullable Stringprotected booleanprotected EntityDataLoadQueryprotected Stringprotected JpqlValidationResult -
Constructor Summary
ConstructorsConstructorDescriptionEntityDataLoadResult(String userText, EntityDataLoadQuery query, JpqlValidationResult validationResult, List<Map<String, Object>> rows, boolean hasMore, boolean executed, @Nullable String executionError) -
Method Summary
Modifier and TypeMethodDescription@Nullable StringReturns the execution error message, ornullif the query was executed successfully or never attempted.getQuery()Returns the query as generated by the LLM, before any validation repair: JPQL, parameters, result-property names, explanation and warnings.getRows()Returns the fetched rows; each map is keyed by the names fromEntityDataLoadQuery.getResultProperties().Returns the original natural-language request the query was generated from.Returns the validation outcome forgetQuery(): parse/semantic issues found before execution.booleanReturns whether the query was actually executed against the database.booleanReturns whether more rows are available in the database beyond the returned page.
-
Field Details
-
userText
-
query
-
validationResult
-
rows
-
hasMore
protected boolean hasMore -
executed
protected boolean executed -
executionError
-
-
Constructor Details
-
EntityDataLoadResult
public EntityDataLoadResult(String userText, EntityDataLoadQuery query, JpqlValidationResult validationResult, List<Map<String, Object>> rows, boolean hasMore, boolean executed, @Nullable String executionError)
-
-
Method Details
-
getQuery
Returns the query as generated by the LLM, before any validation repair: JPQL, parameters, result-property names, explanation and warnings. If the query was repaired during execution, the executed query may differ — only this original version is exposed here.- Returns:
- the LLM-generated query, before any repair
-
getUserText
Returns the original natural-language request the query was generated from.- Returns:
- the original natural-language request
-
getValidationResult
Returns the validation outcome forgetQuery(): parse/semantic issues found before execution. WhenJpqlValidationResult.isValid()isfalsethe query is not executed.- Returns:
- the validation outcome
-
isHasMore
public boolean isHasMore()Returns whether more rows are available in the database beyond the returned page. The caller can re-issue the request with an increasedfirstResult.- Returns:
trueif more rows are available,falseotherwise
-
getRows
Returns the fetched rows; each map is keyed by the names fromEntityDataLoadQuery.getResultProperties(). Empty when the query was not executed or produced no rows.- Returns:
- the fetched rows
-
isExecuted
public boolean isExecuted()Returns whether the query was actually executed against the database.falsemeans generation failed, validation rejected the query, or execution threw — seegetExecutionError().- Returns:
trueif the query was executed,falseotherwise
-
getExecutionError
Returns the execution error message, ornullif the query was executed successfully or never attempted.- Returns:
- the execution error message, or
null
-