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 query that was executed (or failed validation), 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, @Nullable 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 that was executed, or the one that failed validation and was not executed.getRows()Returns the fetched rows; each map is keyed by the names fromgetQuery().getResultProperties().Returns the original natural-language request the query was generated from.Returns the validation outcome forgetQuery(): parse/semantic issues found in it 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, @Nullable Object>> rows, boolean hasMore, boolean executed, @Nullable String executionError)
-
-
Method Details
-
getQuery
Returns the query that was executed, or the one that failed validation and was not executed. It is the LLM-generated query or, if that failed validation, its repair. A repaired query keeps the generatedresult-property names, so the rows stay keyed by them. The row-level conditions added for the current user at execution are not included.- Returns:
- the executed query, or the one that failed validation
-
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 in it 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 fromgetQuery().getResultProperties(). Empty when the query was not executed or produced no rows. A value isnullwhen the query returned no value for that column; an empty string is a value the query actually returned.- 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
-