Package de.xima.fc.prompt.mgmt.gui.model
Class PromptConnectionSelectionModel<Config>
- java.lang.Object
-
- de.xima.fc.prompt.mgmt.gui.model.PromptConnectionSelectionModel<Config>
-
- All Implemented Interfaces:
Serializable
public final class PromptConnectionSelectionModel<Config> extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringerror()Gets the error message, if any, for the currently selected prompt connection.ConfigextractGuiConfig()Extract the final configuration object with the properties of the currently selected prompt connection, that can be persisted in the persistence layer.static PromptConnectionSelectionModel<?>forError(Locale locale, UUID uuid, Throwable error)static PromptConnectionSelectionModel<?>forNewSelection(PromptConnectionViewModel selected, PromptConnectionBeanEnvironment env)IPromptConnectionBean<Config>guiBean()Gets the bean instance needed by the custom GUI provided by the prompt service handler.IGuiIconguiIcon()Gets the icon for the type of the currently selected prompt connection.ResourceBundleguiMessages()Gets the resource bundle containing the GUI messages for the currently selected prompt connection.StringguiXhtml()Gets the URL to the XHTML file that contains the custom GUI for the prompt connection.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.ITestPromptConnectionRetValinvokeHandlerTestConnection()Invokes the test connection method of the prompt service handler and returns the result.IPromptLocklock()Gets the lock, if any, for the currently selected prompt connection.ConfigpendingGuiConfig()Gets the pending configuration object with the properties of the currently selected prompt connection.voidupdateLock(IPromptLock newLock)Updates the lock for the currently selected prompt connection.UUIDuuid()Gets the ID of the currently selected prompt connection represented by this model.
-
-
-
Method Detail
-
error
public String error()
Gets the error message, if any, for the currently selected prompt connection. 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 connection. 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.
-
extractGuiConfig
public Config extractGuiConfig() throws Exception
Extract the final configuration object with the properties of the currently selected prompt connection, that can be persisted in the persistence layer.- Returns:
- The final configuration object of the selected prompt connection.
- Throws:
Exception- If the configuration could not be retrieved.
-
guiBean
public IPromptConnectionBean<Config> guiBean() throws Exception
Gets the bean instance needed by the custom GUI provided by the prompt service handler.- Returns:
- The GUI bean for the prompt connection, 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.
-
guiIcon
public IGuiIcon guiIcon()
Gets the icon for the type of the currently selected prompt connection.- Returns:
- The icon for the selected prompt connection's type, or null if
unavailable.
-
guiMessages
public ResourceBundle guiMessages()
Gets the resource bundle containing the GUI messages for the currently selected prompt connection.- Returns:
- The resource bundle for the selected prompt connection, or null if
unavailable.
-
guiXhtml
public String guiXhtml()
Gets the URL to the XHTML file that contains the custom GUI for the prompt connection.- 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.
-
uuid
public UUID uuid()
Gets the ID of the currently selected prompt connection represented by this model.- Returns:
- The ID of the prompt connection.
-
invokeHandlerTestConnection
public ITestPromptConnectionRetVal invokeHandlerTestConnection()
Invokes the test connection method of the prompt service handler and returns the result.- Returns:
- The result of the test connection invocation.
-
lock
public IPromptLock lock()
Gets the lock, if any, for the currently selected prompt connection. When the data changes in the meantime, an attempt to save the changes will fail with an exception.- Returns:
- The lock for the prompt connection, or null if no lock is held.
-
pendingGuiConfig
public Config pendingGuiConfig()
Gets the pending configuration object with the properties of the currently selected prompt connection. Does not represent the final model. For persisting the model, useextractGuiConfig().- Returns:
- The pending configuration object of the selected prompt connection, or null if
unavailable.
-
updateLock
public void updateLock(IPromptLock newLock)
Updates the lock for the currently selected prompt connection. Usually called after saving the connection to the persistence layer.- Parameters:
newLock- The new lock to set.
-
forError
public static PromptConnectionSelectionModel<?> forError(Locale locale, UUID uuid, Throwable error)
-
forNewSelection
public static PromptConnectionSelectionModel<?> forNewSelection(PromptConnectionViewModel selected, PromptConnectionBeanEnvironment env) throws Exception
- Throws:
Exception
-
-