Class PromptQuerySelectionModel<ConnectionConfig, QueryConfig>

java.lang.Object
de.xima.fc.prompt.mgmt.gui.model.PromptQuerySelectionModel<ConnectionConfig, QueryConfig>
All Implemented Interfaces:
Serializable

public final class PromptQuerySelectionModel<ConnectionConfig, QueryConfig> extends Object implements Serializable
See Also:
  • Constructor Details

  • Method Details

    • extractGuiConfig

      public QueryConfig extractGuiConfig() throws Exception
      Extract the final configuration object with the properties of the currently selected prompt query, that can be persisted in the persistence layer.
      Returns:
      The final configuration object of the selected prompt query.
      Throws:
      Exception - If the configuration could not be retrieved.
    • getError

      public String getError()
      Gets the error message, if any, for the currently selected prompt query. Use hasError() to check if there is an error. An error usually occurs due to a missing plugin or an error in the plugin that handles the prompt query. When this returns a non-null error, pendingGuiConfig() and other methods will return null.
      Returns:
      The error message, or null if there is no error.
    • guiBean

      Gets the bean instance needed by the custom GUI provided by the prompt service handler.
      Returns:
      The GUI bean for the prompt query, or null if unavailable.
      Throws:
      Exception - If the bean instance could not be retrieved, e.g. when the bean class is not found or the bean throws an exception during its construction.
    • guiMessages

      public ResourceBundle guiMessages()
      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 unavailable.
    • guiXhtml

      public String guiXhtml()
      Gets the URL to the XHTML file that contains the custom GUI for the prompt query.
      Returns:
      The URL to the XHTML file, or null if unavailable.
    • hasError

      public boolean hasError()
      Whether this model represents a prompt connection that could not be loaded correctly, usually due to a missing plugin or an error in the plugin that handles the prompt connection. When this returns true, pendingGuiConfig() and other methods will return null.
      Returns:
      true if there is an error, false otherwise.
    • item

      public PromptQueryViewModel item()
    • lock

      public IPromptLock lock()
      Gets the lock, if any, for the currently selected prompt query. When the data changes in the meantime, an attempt to save the changes will fail with an exception.
      Returns:
      The lock for the prompt query, or null if no lock is held.
    • pendingGuiConfig

      public QueryConfig pendingGuiConfig()
      Gets the pending query object with the properties of the currently selected prompt query. Does not represent the final state, do not persist this object. Use extractGuiConfig() for that.
      Returns:
      The configuration object of the selected prompt query, or null if unavailable.
    • type

    • updateLock

      public void updateLock(IPromptLock newLock)
      Updates the lock for the currently selected prompt query. usually called after saving the prompt query to the persistence layer.
      Parameters:
      newLock - The new lock.
    • uuid

      public UUID uuid()
      Gets the ID of the currently selected prompt query represented by this model.
      Returns:
      The ID of the prompt query.
    • withConnection

      public PromptQuerySelectionModel<?,?> withConnection(PromptObjectIdentifier connection) throws Exception
      Returns a new selection model with the same data as this model, but adopted to the given connection. i.e. to the prompt service type that the given connection uses. Used e.g. when the user changes the connection of the prompt query.
      Parameters:
      connection - The new connection.
      Returns:
      A new selection model with the same data as this model, but adopted to the given connection. May return the same instance if the connection did not change.
      Throws:
      Exception - If the new selection model could not be created.
    • forError

      public static PromptQuerySelectionModel<?,?> forError(Locale locale, UUID uuid, Throwable error)
    • forNewSelection

      public static PromptQuerySelectionModel<?,?> forNewSelection(PromptQueryViewModel query, PromptQueryBeanEnvironment env) throws Exception
      Throws:
      Exception