Package de.xima.fc.prompt.mgmt.gui.bean
Class PromptConnectionBean
- java.lang.Object
-
- de.xima.fc.prompt.mgmt.gui.bean.PromptConnectionBean
-
- All Implemented Interfaces:
Serializable
@ViewScoped @Named public class PromptConnectionBean extends Object implements Serializable
Controller bean for the UI that lets the user manage prompt connections.- Since:
- 8.5.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PromptConnectionBean(LocaleBean localeBean, PromptServicePluginLocator pluginLocator, IPromptTypeService typeService, IPromptManagementService managementService, SessionUserManager userManager, ViewContextBean viewContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IPromptConnectionBean<?>getGuiBean()Gets the bean instance needed by the custom GUI of the prompt service handler.IGuiIcongetGuiIcon()Gets the icon for the currently selected prompt connection type.ResourceBundlegetGuiMessages()Gets the resource bundle containing the GUI messages for the currently selected prompt connection.ObjectgetGuiModel()Gets the configuration object with the properties of the currently selected prompt connection.StringgetGuiXhtml()Gets the URL to the XHTML file that defines the custom GUI for the currently selected prompt connection.PromptConnectionListModelgetModel()Gets the model that contains the list of prompt connections.List<IPromptServiceTypeInfo>getPromptConnectionTypes()Gets a list of all available prompt connection types.PromptScopegetScope()Gets the scope of the prompt connections being edited, i.e. whether we are editing system connections, tenant connections, or project connections.StringgetSelectedError()If theselect item has an error, returns the error message.booleanisHasGui()Checks if a custom GUI is available for the currently selected prompt connection.booleanisHasSelectedError()Checks whether a prompt connection is selected, but it could not be loaded correctly.StringnumericId(UUID uuid)Returns a numeric ID for the given connection UUID.voidonCheckConnection()Callback when the user clicks on the button to test the connection.voidonTypeSelected(IPromptServiceTypeInfo item)Called when clicks the plus button to add a new prompt connection and then selects one of available prompt connection types from the type selection menu.
-
-
-
Constructor Detail
-
PromptConnectionBean
@Inject public PromptConnectionBean(LocaleBean localeBean, PromptServicePluginLocator pluginLocator, IPromptTypeService typeService, IPromptManagementService managementService, SessionUserManager userManager, ViewContextBean viewContext)
-
-
Method Detail
-
getGuiBean
public IPromptConnectionBean<?> 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 connection, or null if not available.
-
getGuiIcon
public IGuiIcon getGuiIcon()
Gets the icon for the currently selected prompt connection type. The icon is used in the UI to visually represent the type of prompt connection.- Returns:
- The GUI icon for the selected prompt connection type, or null if not available.
-
getGuiMessages
public ResourceBundle getGuiMessages()
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 not available.
-
getGuiModel
public Object getGuiModel()
Gets the configuration object with the properties of the currently selected prompt connection.- Returns:
- The configuration object of the selected prompt connection, 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.
-
getModel
public PromptConnectionListModel getModel()
Gets the model that contains the list of prompt connections.- Returns:
- The model containing prompt connections, never null.
-
getPromptConnectionTypes
public List<IPromptServiceTypeInfo> getPromptConnectionTypes()
Gets a list of all available prompt connection types. This is used for the type selection menu when the user creates a new prompt connection.- Returns:
- A list of available prompt connection types, never null
-
getScope
public PromptScope getScope()
Gets the scope of the prompt connections being edited, i.e. whether we are editing system connections, tenant connections, or project connections.- Returns:
- The prompt scope.
-
getSelectedError
public String getSelectedError()
If theselect item has an error, returns the error message. Otherwise, returns null.- Returns:
- The error if present, null otherwise.
-
isHasGui
public boolean isHasGui()
Checks if a custom GUI is available for the currently selected prompt connection.- Returns:
- true if a custom GUI is available, false otherwise.
-
isHasSelectedError
public boolean isHasSelectedError()
Checks whether a prompt connection is selected, but it could not be loaded correctly. This usually happens when the plugin that handles the prompt connection is unavailable or has issues.- Returns:
- true if there is a selected prompt connection with an error, false otherwise.
-
numericId
public String numericId(UUID uuid)
Returns a numeric ID for the given connection 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 connection for which to retrieve a numeric UUID.- Returns:
- A numeric string for the UUID.
-
onCheckConnection
public void onCheckConnection()
Callback when the user clicks on the button to test the connection. Retrieves the handler of the currently selected prompt connection and invokes its test connection method. Shows a success message if the test succeeds, or an error message if it fails.
-
onTypeSelected
public void onTypeSelected(IPromptServiceTypeInfo item)
Called when clicks the plus button to add a new prompt connection and then selects one of available prompt connection types from the type selection menu.- Parameters:
item- The item that was selected.
-
-