Package de.xima.fc.gui.bean.portal
Class UserPortalConfigBean
- java.lang.Object
-
- de.xima.fc.gui.bean.portal.UserPortalConfigBean
-
- All Implemented Interfaces:
IStateHolder
,Serializable
@Named @ViewScoped public class UserPortalConfigBean extends Object implements Serializable, IStateHolder
Configuration of a single selected user portal via different tabs.- Since:
- 8.2.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UserPortalConfigBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
completeLanguageTag(String query)
When the user triggers an autocomplete for a language tag input.void
discardChanges()
Discards the changes.EConnectionStatus
getConnectionStatus(IServerModel server)
Gets the connection status of the given server.List<String>
getCustomPortalFileKeys()
A list of custom file keys that can be configured on the advanced tab of a user portal.List<String>
getCustomPortalMessageKeys()
A list of custom message keys that can be configured on the advanced tab of a user portal.Map<String,String>
getDefaultPortalFileTextContent()
Map<String,String>
getDefaultProjectFileTextContent()
List<FrontendServer>
getFsToReconnect()
UserPortalViewModel
getModel()
Gets the view model for editing the selected user portal.Map<String,String>
getPortalFileTextContent()
Map<String,String>
getProjectFileTextContent()
Locale
getRequestedDefaultLocale()
Gets the requested default locale for the user portal configuration.Locale
getRequestedLocale()
Gets the requested locale for the user portal configuration.List<org.apache.commons.lang3.tuple.Pair<String,String>>
getUserPortalUrls(IServerModel server)
Gets the URL to the user portal for the given server (with additional client information if the server is a client frontend server).void
init()
boolean
isConnected(IServerModel server)
Returns whether the given server is connected.void
newUserPortal()
Creates a new user portal and prepares it for editing.void
onAddCustomPortalFileKeyClicked()
void
onAddCustomPortalMessageKeyClicked()
void
onAddNewTagClicked()
When the user clicks the "Add" button to create a new tag, this method will be called.void
onAfterPortalDeleted()
Called when a portal deleted.void
onDefaultLocaleChanged()
When the default locale of the portal was changed, usually when the user selected a different locale in the backend UI.void
onEditAuthClicked(AuthenticatorConfigViewModel config)
Called when the user clicks the "Edit" button for a login server configuration.void
onEditTagClicked(ProjectPortalTagViewModel tag)
Called when the user clicks the "Edit" button for a tag.void
onFileDeleted(String type, String fileKey)
Called when the user click on the button to delete an existing file.void
onFileUploaded(org.primefaces.event.FileUploadEvent event)
Called when the user uploads a file in the backend UI.void
onLocaleAdded()
When the user added a new locale, such as by clicking on the add button in the language selector.void
onLocaleChanged(String languageTag)
Called when the user changes the locale in the UI.void
onLocaleDeleted(String languageTag)
When the user deleted an available locale, such as by clicking on the delete button in the language selector.void
onPropertyKeyChange(javax.faces.event.ValueChangeEvent event)
Called when the user changes the key of a custom message.void
onRemoveCustomPortalFileKeyClicked(String key)
void
onRemoveCustomPortalMessageKeyClicked(String key)
void
onReorderInputAuthenticators(org.primefaces.event.ReorderEvent event)
When the user reordered input login services via the UI.void
onReorderRedirectAuthenticators(org.primefaces.event.ReorderEvent event)
When the user reordered redirect login services via the UI.void
reconnectFrontendServers()
String
resolveTagBackgroundColor(ProjectPortalTagViewModel tag)
Resolves the color for the background of a given tag, used to display the tag on the UI.String
resolveTagDisplayName(ProjectPortalTagViewModel tag)
Resolves the display name for the given tag, used to display the tag on the UI.String
resolveTagTextColor(ProjectPortalTagViewModel tag)
Resolves the text color for the background of a given tag, used to display the tag on the UI.void
saveChanges()
Saves the changes.void
setFirstPortalFromList(List<UserPortal> portals)
Selects the first portal from the given list of portals.void
setFsToReconnect(List<FrontendServer> fsToReconnect)
void
setRequestedDefaultLocale(Locale requestedDefaultLocale)
Gets the requested default locale for the user portal configuration.void
setRequestedLocale(Locale requestedLocale)
Sets the requested locale for the user portal configuration.boolean
showConnectionStatus(IServerModel server)
Returns whether the connection status should be shown for the given server.
-
-
-
Method Detail
-
init
@PostConstruct public void init()
-
getCustomPortalFileKeys
public List<String> getCustomPortalFileKeys()
A list of custom file keys that can be configured on the advanced tab of a user portal.- Returns:
- List of custom file keys.
-
getCustomPortalMessageKeys
public List<String> getCustomPortalMessageKeys()
A list of custom message keys that can be configured on the advanced tab of a user portal.- Returns:
- List of custom message keys.
-
getUserPortalUrls
public List<org.apache.commons.lang3.tuple.Pair<String,String>> getUserPortalUrls(IServerModel server)
Gets the URL to the user portal for the given server (with additional client information if the server is a client frontend server).- Parameters:
server
- Server to get the URL for.- Returns:
- URL to the user portal.
-
getConnectionStatus
public EConnectionStatus getConnectionStatus(IServerModel server)
Gets the connection status of the given server.- Parameters:
server
- Server to get the connection status for.- Returns:
- Connection status of the server.
-
showConnectionStatus
public boolean showConnectionStatus(IServerModel server)
Returns whether the connection status should be shown for the given server.- Parameters:
server
- Server to check.- Returns:
true
if the connection status should be shown,false
otherwise.
-
isConnected
public boolean isConnected(IServerModel server)
Returns whether the given server is connected.- Parameters:
server
- Server to check.- Returns:
true
if the server is connected,false
otherwise.
-
getModel
public UserPortalViewModel getModel()
Gets the view model for editing the selected user portal.- Returns:
- View model for the selected user portal.
-
getRequestedDefaultLocale
public Locale getRequestedDefaultLocale()
Gets the requested default locale for the user portal configuration. The view should just useUserPortalViewModel.getDefaultLocale()
()}, but then we run into issues when the user changes the locale. The data for the current locale needs to be applied first, then the locale needs to be changed. Otherwise, the data is applied to the wrong locale.- Returns:
- Requested default locale for the user portal configuration.
-
setRequestedDefaultLocale
public void setRequestedDefaultLocale(Locale requestedDefaultLocale)
Gets the requested default locale for the user portal configuration. The view should just useUserPortalViewModel.getDefaultLocale()
()}, but then we run into issues when the user changes the locale. The data for the current locale needs to be applied first, then the locale needs to be changed. Otherwise, the data is applied to the wrong locale.- Parameters:
requestedDefaultLocale
- Requested default locale for the user portal configuration.
-
getRequestedLocale
public Locale getRequestedLocale()
Gets the requested locale for the user portal configuration. The view should just useUserPortalViewModel.getSelectedLocale()
, but then we run into issues when the user changes the locale. The data for the current locale needs to be applied first, then the locale needs to be changed. Otherwise, the data is applied to the wrong locale.- Returns:
- Requested locale for the user portal configuration.
-
setRequestedLocale
public void setRequestedLocale(Locale requestedLocale)
Sets the requested locale for the user portal configuration. The view should just useUserPortalViewModel.getSelectedLocale()
, but then we run into issues when the user changes the locale. The data for the current locale needs to be applied first, then the locale needs to be changed. Otherwise, the data is applied to the wrong locale.- Parameters:
requestedLocale
- Requested locale for the user portal configuration.
-
getFsToReconnect
public List<FrontendServer> getFsToReconnect()
-
setFsToReconnect
public void setFsToReconnect(List<FrontendServer> fsToReconnect)
-
setFirstPortalFromList
public void setFirstPortalFromList(List<UserPortal> portals)
Selects the first portal from the given list of portals.- Parameters:
portals
- List of portals to select from.
-
completeLanguageTag
public List<String> completeLanguageTag(String query)
When the user triggers an autocomplete for a language tag input. Searches the well-known locales for a match, either by language tag or by display name.- Parameters:
query
- The query to complete.- Returns:
- List of language tags that match the query.
-
newUserPortal
public void newUserPortal()
Creates a new user portal and prepares it for editing.
-
onAddCustomPortalFileKeyClicked
public void onAddCustomPortalFileKeyClicked()
-
onAddCustomPortalMessageKeyClicked
public void onAddCustomPortalMessageKeyClicked()
-
onAddNewTagClicked
public void onAddNewTagClicked()
When the user clicks the "Add" button to create a new tag, this method will be called. It will create a new tag with the given name and add it to the list of tags.
-
onAfterPortalDeleted
public void onAfterPortalDeleted()
Called when a portal deleted. Checks if the currently edited portal still exists. If not, finds a new portal to edit and loads its configuration.
-
onDefaultLocaleChanged
public void onDefaultLocaleChanged()
When the default locale of the portal was changed, usually when the user selected a different locale in the backend UI.
-
onEditAuthClicked
public void onEditAuthClicked(AuthenticatorConfigViewModel config)
Called when the user clicks the "Edit" button for a login server configuration. Prepares the model so that it can be edited.- Parameters:
config
- Login service configuration to edit.
-
onEditTagClicked
public void onEditTagClicked(ProjectPortalTagViewModel tag)
Called when the user clicks the "Edit" button for a tag. Prepares the model so that the tag can be edited.- Parameters:
tag
- Tag to edit.
-
onFileDeleted
public void onFileDeleted(String type, String fileKey)
Called when the user click on the button to delete an existing file.- Parameters:
type
- The type of the file (project or portal)fileKey
- The key of the file to delete.
-
onFileUploaded
public void onFileUploaded(org.primefaces.event.FileUploadEvent event)
Called when the user uploads a file in the backend UI.- Parameters:
event
- File upload event with the file.
-
onLocaleAdded
public void onLocaleAdded()
When the user added a new locale, such as by clicking on the add button in the language selector. Adds the locale to the list of available locales, selects the new locale, and updates the model so that the new locale can be edited.
-
onLocaleChanged
public void onLocaleChanged(String languageTag)
Called when the user changes the locale in the UI. This will prepare the view model so that the data for that locale can be edited.
-
onLocaleDeleted
public void onLocaleDeleted(String languageTag)
When the user deleted an available locale, such as by clicking on the delete button in the language selector. Removes the locale from the list of available locales, and, if the deleted locale was the currently selected locale, changes the locale to the default locale and updates the model.- Parameters:
languageTag
- The language tag of the deleted locale.
-
onRemoveCustomPortalFileKeyClicked
public void onRemoveCustomPortalFileKeyClicked(String key)
-
onRemoveCustomPortalMessageKeyClicked
public void onRemoveCustomPortalMessageKeyClicked(String key)
-
onReorderInputAuthenticators
public void onReorderInputAuthenticators(org.primefaces.event.ReorderEvent event)
When the user reordered input login services via the UI. Updates the model with the new order.- Parameters:
event
- Reorder event with the new order.
-
onReorderRedirectAuthenticators
public void onReorderRedirectAuthenticators(org.primefaces.event.ReorderEvent event)
When the user reordered redirect login services via the UI. Updates the model with the new order.- Parameters:
event
- Reorder event with the new order.
-
resolveTagBackgroundColor
public String resolveTagBackgroundColor(ProjectPortalTagViewModel tag)
Resolves the color for the background of a given tag, used to display the tag on the UI. Uses the configured color first, falling back to the default color.- Parameters:
tag
- Tag to resolve the background color for.- Returns:
- Background color for the tag.
-
resolveTagDisplayName
public String resolveTagDisplayName(ProjectPortalTagViewModel tag)
Resolves the display name for the given tag, used to display the tag on the UI. Uses the current language first, falling back to the default language. When no display name is found, the tag's ID is used.- Parameters:
tag
- Tag to resolve the display name for.- Returns:
- Display name for the tag.
-
resolveTagTextColor
public String resolveTagTextColor(ProjectPortalTagViewModel tag)
Resolves the text color for the background of a given tag, used to display the tag on the UI. Uses the configured color, falling back to the default color.- Parameters:
tag
- Tag to resolve the background color for.- Returns:
- Background color for the tag.
-
saveChanges
public void saveChanges()
Description copied from interface:IStateHolder
Saves the changes.- Specified by:
saveChanges
in interfaceIStateHolder
-
discardChanges
public void discardChanges()
Description copied from interface:IStateHolder
Discards the changes.- Specified by:
discardChanges
in interfaceIStateHolder
-
reconnectFrontendServers
public void reconnectFrontendServers()
-
onPropertyKeyChange
public void onPropertyKeyChange(javax.faces.event.ValueChangeEvent event)
Called when the user changes the key of a custom message. Updates the key in the model and in all properties of every locale.- Parameters:
event
- Value change event with the old and new key.
-
-