Class PromptQueryBean
java.lang.Object
de.xima.fc.prompt.mgmt.gui.bean.PromptQueryBean
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPromptQueryBean(LocaleBean localeBean, PromptServicePluginLocator pluginLocator, IPromptTypeService typeService, IPromptManagementService managementService, SessionUserManager userManager, ViewContextBean viewContext) -
Method Summary
Modifier and TypeMethodDescriptionGets a list of all available, configured prompt connections for the current tenant.IPromptQueryBean<?, ?> Gets the bean instance needed by the custom GUI of the prompt service handler.Gets the resource bundle containing the GUI messages for the currently selected prompt query.Gets the configuration object with the properties of the currently selected prompt query.Gets the URL to the XHTML file that defines the custom GUI for the currently selected prompt connection.getIcon(PromptQueryViewModel item) Gets the file list handler for the<xi:fileList />component that lets the user upload the input files needed by the prompt query during execution.getModel()Gets the model that contains the list of prompt queries.Gets the file list handler for the<xi:fileList />component that lets the view the output files produced by the prompt query during execution.getScope()Gets the scope of the prompt queries being edited, i.e. whether we are editing system queries, tenant queries, or project queries.If theselect item has an error, returns the error message.Gets the view model for testing the currently selected prompt query.booleanisHasGui()Checks if a custom GUI is available for the currently selected prompt query.booleanChecks whether a prompt query is selected, but it could not be loaded correctly.Returns a numeric ID for the given query UUID.voidCallback invoked by the UI when the user changes the prompt connection of the prompt query.voidCalled when the user clicks on the "Test query" button in the UI, after invoking theonQueryExecutionPrepare()method.voidCalled when the user clicks on the "Test query" button in the UI.voidonSave()When the user clicks the "Save" button in the UI.
-
Constructor Details
-
PromptQueryBean
@Inject public PromptQueryBean(LocaleBean localeBean, PromptServicePluginLocator pluginLocator, IPromptTypeService typeService, IPromptManagementService managementService, SessionUserManager userManager, ViewContextBean viewContext)
-
-
Method Details
-
getConnectionOptions
Gets a list of all available, configured prompt connections for the current tenant. Each query must be associated with a connection that it upon execution.- Returns:
- A list of available prompt connections.
-
getIcon
-
getGuiBean
Gets the bean instance needed by the custom GUI of the prompt service handler. Returns null if the handler does not define a custom bean.- Returns:
- The GUI bean for the prompt query, or null if not available.
-
getGuiMessages
Gets the resource bundle containing the GUI messages for the currently selected prompt query.- Returns:
- The resource bundle for the selected prompt query, or null if not available.
-
getGuiModel
Gets the configuration object with the properties of the currently selected prompt query.- Returns:
- The configuration object of the selected prompt query, or null if unavailable.
-
getGuiXhtml
Gets the URL to the XHTML file that defines the custom GUI for the currently selected prompt connection.- Returns:
- The URL to the custom GUI XHTML, or null if no custom GUI is defined.
-
getInputTestFileListHandler
Gets the file list handler for the<xi:fileList />component that lets the user upload the input files needed by the prompt query during execution.- Returns:
- The file list handler for prompt query input files.
-
getModel
Gets the model that contains the list of prompt queries.- Returns:
- The model containing prompt queries, never null.
-
getOutputTestFileListHandler
Gets the file list handler for the<xi:fileList />component that lets the view the output files produced by the prompt query during execution.- Returns:
- The file list handler for prompt query output files.
-
getScope
Gets the scope of the prompt queries being edited, i.e. whether we are editing system queries, tenant queries, or project queries.- Returns:
- The prompt scope.
-
getSelectedError
If theselect item has an error, returns the error message. Otherwise, returns null.- Returns:
- The error if present, null otherwise.
-
getTestModel
Gets the view model for testing the currently selected prompt query. The test view model contains the information needed to render the test UI, such as the input parameters and file controls. It also contains the result of the latest test execution, if any.- Returns:
- The test view model, or null if no prompt query is selected or if the selected query has an error.
-
isHasGui
public boolean isHasGui()Checks if a custom GUI is available for the currently selected prompt query.- Returns:
- true if a custom GUI is available, false otherwise.
-
isHasSelectedError
public boolean isHasSelectedError()Checks whether a prompt query is selected, but it could not be loaded correctly. This usually happens when the plugin that handles the prompt query is unavailable or has issues.- Returns:
- true if there is a selected prompt query with an error, false otherwise.
-
numericId
Returns a numeric ID for the given query UUID. This is used for the row key attribute of PrimeFaces components. Even though the documentation says it can be any string, the data table component breaks in subtle ways if the row key is not numeric. For example, the selections / marked rows are not displayed and synchronized with the server correctly. (This happens with PrimeFaces 13.x, may have been fixed in later versions.)- Parameters:
uuid- The UUID of a query for which to retrieve a numeric ID.- Returns:
- A numeric string for the ID.
-
onConnectionChange
public void onConnectionChange()Callback invoked by the UI when the user changes the prompt connection of the prompt query. The UI depends on the type of the prompt connection. Reloads the selection model to prepare the UI for the new connection. -
onQueryExecutionPerform
public void onQueryExecutionPerform()Called when the user clicks on the "Test query" button in the UI, after invoking theonQueryExecutionPrepare()method. This method executes the prompt query with the currently configured input parameters and files, and updates the test model with the result of the execution. -
onQueryExecutionPrepare
public void onQueryExecutionPrepare()Called when the user clicks on the "Test query" button in the UI. Updates the test model to reflect the current state of the input parameters and files. This update the UI, which may now have different input fields (if the query configuration changed). The UI then invokes theonQueryExecutionPrepare()method to actually execute the prompt query. -
onSave
public void onSave()When the user clicks the "Save" button in the UI. Saves the current configuration of the selected prompt query in the persistence layer, and also updates the test model to reflect any changes in the configuration.
-