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.Map<String,Object>createFileUploadAttributes(String type, String fileKey)voiddeleteUserPortalContent(UserPortalContentViewModel userPortalContentViewModel)voiddiscardChanges()Discards the changes.voidevaluateSelectedContentEditPermissions()EConnectionStatusgetConnectionStatus(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>getDefaultUserPortalContentFileTextContent()StringgetFormDesignerUriOfSelectedFormContent()List<FrontendServer>getFsToReconnect()LocaleBeangetLocaleBean()UserPortalViewModelgetModel()de.xima.fc.gui.bean.portal.UserPortalConfigBean.PermissionEvaluationCachegetPermissionEvaluationCache()UserPortalgetPortal()Map<String,String>getPortalFileTextContent()LocalegetRequestedDefaultLocale()Gets the requested default locale for the user portal configuration.LocalegetRequestedLocale()Gets the requested locale for the user portal configuration.ResourceBundleBeangetResourceBundleBean()SelectionBeangetSelectionBean()SessionUserManagergetUserManager()UserPermissionsBeangetUserPermissionsBean()UserPortalBeangetUserPortalBean()Map<String,String>getUserPortalContentFileTextContent()StringgetUserPortalContentLinkTooltip(UserPortalContentViewModel userPortalContentViewModel)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).ViewContextBeangetViewContextBean()voidinit()booleanisCanUserEditSelectedFormContent()booleanisCanUserEditTenantResources()booleanisCanUserEditTenantTemplateUrls()booleanisConnected(IServerModel server)Returns whether the given server is connected.voidnewUserPortal()Creates a new user portal and prepares it for editing.voidonAddCustomPortalFileKeyClicked()voidonAddNewTagClicked()When the user clicks the "Add" button to create a new tag, this method will be called.voidonAfterPortalDeleted()Called when a portal deleted.voidonDefaultLocaleChanged()When the default locale of the portal was changed, usually when the user selected a different locale in the backend UI.voidonEditTagClicked(UserPortalContentTagViewModel tag)Called when the user clicks the "Edit" button for a tag.voidonFileDeleted(String type, String fileKey)Called when the user click on the button to delete an existing file.voidonFileUploaded(org.primefaces.event.FileUploadEvent event)Called when the user uploads a file in the backend UI.voidonLocaleAdded()When the user added a new locale, such as by clicking on the add button in the language selector.voidonLocaleChanged(String languageTag)Called when the user changes the locale in the UI.voidonLocaleDeleted(String languageTag)When the user deleted an available locale, such as by clicking on the delete button in the language selector.voidonPropertyKeyChange(javax.faces.event.ValueChangeEvent event)Called when the user changes the key of a custom message.voidonRemoveCustomPortalFileKeyClicked(String key)voidonRemoveCustomPortalMessageKeyClicked(String key)voidonReorderInputAuthenticators(org.primefaces.event.ReorderEvent event)When the user reordered input login services via the UI.voidonReorderRedirectAuthenticators(org.primefaces.event.ReorderEvent event)When the user reordered redirect login services via the UI.voidreconnectFrontendServers()StringresolveTagBackgroundColor(UserPortalContentTagViewModel tag)Resolves the color for the background of a given tag, used to display the tag on the UI.StringresolveTagTextColor(UserPortalContentTagViewModel tag)Resolves the text color for the background of a given tag, used to display the tag on the UI.voidsaveChanges()Saves the changes.voidsetFirstPortalFromList(List<UserPortal> portals)Selects the first portal from the given list of portals.voidsetFsToReconnect(List<FrontendServer> fsToReconnect)voidsetRequestedDefaultLocale(Locale requestedDefaultLocale)Gets the requested default locale for the user portal configuration.voidsetRequestedLocale(Locale requestedLocale)Sets the requested locale for the user portal configuration.voidsetSelectedUserPortalContent(UserPortalContentViewModel selectedUserPortalContent)booleanshowConnectionStatus(IServerModel server)Returns whether the connection status should be shown for the given server.List<UserPortalFileViewModel>wrapFile(UserPortalFileViewModel file)
-
-
-
Method Detail
-
init
@PostConstruct public void init()
-
setSelectedUserPortalContent
public void setSelectedUserPortalContent(UserPortalContentViewModel selectedUserPortalContent)
-
isCanUserEditTenantResources
public boolean isCanUserEditTenantResources()
-
isCanUserEditTenantTemplateUrls
public boolean isCanUserEditTenantTemplateUrls()
-
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:
trueif the connection status should be shown,falseotherwise.
-
isConnected
public boolean isConnected(IServerModel server)
Returns whether the given server is connected.- Parameters:
server- Server to check.- Returns:
trueif the server is connected,falseotherwise.
-
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.
-
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.
-
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()
-
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.
-
getUserPortalContentLinkTooltip
public String getUserPortalContentLinkTooltip(UserPortalContentViewModel userPortalContentViewModel)
-
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.
-
onEditTagClicked
public void onEditTagClicked(UserPortalContentTagViewModel 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 (user portal content or user 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.
-
wrapFile
public List<UserPortalFileViewModel> wrapFile(UserPortalFileViewModel file)
-
createFileUploadAttributes
public Map<String,Object> createFileUploadAttributes(String type, String fileKey)
-
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)
-
deleteUserPortalContent
public void deleteUserPortalContent(UserPortalContentViewModel userPortalContentViewModel)
-
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(UserPortalContentTagViewModel 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.
-
resolveTagTextColor
public String resolveTagTextColor(UserPortalContentTagViewModel 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:IStateHolderSaves the changes.- Specified by:
saveChangesin interfaceIStateHolder
-
discardChanges
public void discardChanges()
Description copied from interface:IStateHolderDiscards the changes.- Specified by:
discardChangesin interfaceIStateHolder
-
reconnectFrontendServers
public void reconnectFrontendServers()
-
evaluateSelectedContentEditPermissions
public void evaluateSelectedContentEditPermissions()
-
getFormDesignerUriOfSelectedFormContent
public String getFormDesignerUriOfSelectedFormContent()
-
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.
-
getDefaultUserPortalContentFileTextContent
public Map<String,String> getDefaultUserPortalContentFileTextContent()
-
getUserPortalContentFileTextContent
public Map<String,String> getUserPortalContentFileTextContent()
-
getUserManager
public SessionUserManager getUserManager()
-
getLocaleBean
public LocaleBean getLocaleBean()
-
getSelectionBean
public SelectionBean getSelectionBean()
-
getUserPermissionsBean
public UserPermissionsBean getUserPermissionsBean()
-
getUserPortalBean
public UserPortalBean getUserPortalBean()
-
getViewContextBean
public ViewContextBean getViewContextBean()
-
getResourceBundleBean
public ResourceBundleBean getResourceBundleBean()
-
getModel
public UserPortalViewModel getModel()
-
getPortal
public UserPortal getPortal()
-
getFsToReconnect
public List<FrontendServer> getFsToReconnect()
-
isCanUserEditSelectedFormContent
public boolean isCanUserEditSelectedFormContent()
-
getPermissionEvaluationCache
public de.xima.fc.gui.bean.portal.UserPortalConfigBean.PermissionEvaluationCache getPermissionEvaluationCache()
-
setRequestedDefaultLocale
public void setRequestedDefaultLocale(Locale requestedDefaultLocale)
Gets the requested default locale for the user portal configuration. The view should just use, 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.
-
setRequestedLocale
public void setRequestedLocale(Locale requestedLocale)
Sets the requested locale for the user portal configuration. The view should just use, 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.
-
setFsToReconnect
public void setFsToReconnect(List<FrontendServer> fsToReconnect)
-
-