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 Summary
ConstructorsConstructorDescriptionPromptQuerySelectionModel(UUID uuid, IPromptLock lock, PromptQueryViewModel selected, IPromptServiceType<ConnectionConfig, QueryConfig> type, QueryConfig config, PromptQueryBeanEnvironment env) PromptQuerySelectionModel(UUID uuid, String message) -
Method Summary
Modifier and TypeMethodDescriptionExtract the final configuration object with the properties of the currently selected prompt query, that can be persisted in the persistence layer.static PromptQuerySelectionModel<?, ?> static PromptQuerySelectionModel<?, ?> getError()Gets the error message, if any, for the currently selected prompt query.guiBean()Gets the bean instance needed by the custom GUI provided by the prompt service handler.Gets the resource bundle containing the GUI messages for the currently selected prompt query.guiXhtml()Gets the URL to the XHTML file that contains the custom GUI for the prompt query.booleanhasError()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.item()lock()Gets the lock, if any, for the currently selected prompt query.Gets the pending query object with the properties of the currently selected prompt query.type()voidupdateLock(IPromptLock newLock) Updates the lock for the currently selected prompt query. usually called after saving the prompt query to the persistence layer.uuid()Gets the ID of the currently selected prompt query represented by this model.withConnection(PromptObjectIdentifier connection) 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.
-
Constructor Details
-
PromptQuerySelectionModel
-
PromptQuerySelectionModel
public PromptQuerySelectionModel(UUID uuid, IPromptLock lock, PromptQueryViewModel selected, IPromptServiceType<ConnectionConfig, QueryConfig> type, QueryConfig config, PromptQueryBeanEnvironment env)
-
-
Method Details
-
extractGuiConfig
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
Gets the error message, if any, for the currently selected prompt query. UsehasError()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
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
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
-
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
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. UseextractGuiConfig()for that.- Returns:
- The configuration object of the selected prompt query, or null if
unavailable.
-
type
-
updateLock
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
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
-
forNewSelection
public static PromptQuerySelectionModel<?,?> forNewSelection(PromptQueryViewModel query, PromptQueryBeanEnvironment env) throws Exception - Throws:
Exception
-