Class PromptQueryBean

    • Method Detail

      • getConnectionOptions

        public PromptConnectionOptions 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.
      • getGuiBean

        public IPromptQueryBean<?,​?> 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

        public ResourceBundle 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

        public Object 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

        public String 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

        public IFileListHandler<PromptTestFile> 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

        public PromptQueryListModel getModel()
        Gets the model that contains the list of prompt queries.
        Returns:
        The model containing prompt queries, never null.
      • getOutputTestFileListHandler

        public IFileListHandler<IPromptBinaryData> 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

        public PromptScope 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

        public String getSelectedError()
        If the select item has an error, returns the error message. Otherwise, returns null.
        Returns:
        The error if present, null otherwise.
      • getTestModel

        public PromptQueryTestViewModel 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

        public String numericId​(UUID uuid)
        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 the onQueryExecutionPrepare() 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 the onQueryExecutionPrepare() 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.