Class UserPortalContentBean
- java.lang.Object
-
- de.xima.fc.gui.bean.portal.UserPortalContentBean
-
- All Implemented Interfaces:
Serializable
@Named @ViewScoped public class UserPortalContentBean extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected SessionUserManageruserManager
-
Constructor Summary
Constructors Constructor Description UserPortalContentBean()
-
Method Summary
-
-
-
Field Detail
-
userManager
@Inject protected SessionUserManager userManager
-
-
Method Detail
-
hasUserClientAccessForTenantResourceView
public boolean hasUserClientAccessForTenantResourceView()
-
hasUserClientAccessForTenantTemplateUrlView
public boolean hasUserClientAccessForTenantTemplateUrlView()
-
startAddUserPortalContentWithType
public void startAddUserPortalContentWithType(EUserPortalContentConfigType contentType)
Starts the add-content flow for the given content type.This initializes a temporary content model, resolves the tenant context for the new entry, reloads the tenant-dependent selection data, and optionally triggers the create-entity dialog for content types that support creating linked entities directly from the selection flow.
- Parameters:
contentType- content type to create
-
onChangeTenantTemplateEntity
public void onChangeTenantTemplateEntity()
-
onChangeTenantResourceEntity
public void onChangeTenantResourceEntity()
-
onChangeFormEntity
public void onChangeFormEntity()
-
showSelectedContentEntityEditButton
public boolean showSelectedContentEntityEditButton(EUserPortalContentConfigType contentType)
-
handleContentEntityFileUpload
public void handleContentEntityFileUpload(org.primefaces.event.FileUploadEvent event)
-
getSelectedContentTenantResourceFiles
public List<UserPortalFileViewModel> getSelectedContentTenantResourceFiles()
-
removeSelectedContentEntityFile
public void removeSelectedContentEntityFile(javax.faces.event.ActionEvent event)
-
setSelectedUserPortalContent
public void setSelectedUserPortalContent(UserPortalContentViewModel selectedUserPortalContent)
-
discardTemporaryUserPortalContent
public void discardTemporaryUserPortalContent()
-
isSelectedUserPortalContent
public boolean isSelectedUserPortalContent(UserPortalContentViewModel userPortalContent)
-
getPersistedUserPortalContents
public List<UserPortalContentViewModel> getPersistedUserPortalContents()
-
getTemporaryUserPortalContent
public UserPortalContentViewModel getTemporaryUserPortalContent()
-
isLinkedEntitySelectionVisible
public boolean isLinkedEntitySelectionVisible()
-
setUserPortalContentType
public void setUserPortalContentType(EUserPortalContentConfigType contentType)
-
hasUnexistingTenantResources
public boolean hasUnexistingTenantResources()
-
hasUnexistingTenantUrls
public boolean hasUnexistingTenantUrls()
-
hasUnexistingForms
public boolean hasUnexistingForms()
-
getAvailableFormSelectItems
public List<javax.faces.model.SelectItem> getAvailableFormSelectItems()
-
getAvailableClientResourceSelectItems
public List<javax.faces.model.SelectItem> getAvailableClientResourceSelectItems()
-
getAvailableClientUrlSelectItems
public List<javax.faces.model.SelectItem> getAvailableClientUrlSelectItems()
-
getAvailableClientSelectItems
public List<javax.faces.model.SelectItem> getAvailableClientSelectItems()
-
getAvailableFormContentInfos
public Map<UUID,UserPortalTenantContentLoader.TenantContentSelectItemInfo> getAvailableFormContentInfos()
-
getAvailableResourceContentInfos
public Map<UUID,UserPortalTenantContentLoader.TenantContentSelectItemInfo> getAvailableResourceContentInfos()
-
getAvailableTemplateContentInfos
public Map<UUID,UserPortalTenantContentLoader.TenantContentSelectItemInfo> getAvailableTemplateContentInfos()
-
getAvailableContentDisplayLabel
public String getAvailableContentDisplayLabel(EUserPortalContentConfigType contentType, UUID contentUuid)
-
getSelectedResourceEntityMetaLabel
public String getSelectedResourceEntityMetaLabel()
-
getSelectedTemplateEntityMetaLabel
public String getSelectedTemplateEntityMetaLabel()
-
onChangeTenantSelection
public void onChangeTenantSelection()
-
refreshAvailableContentSelection
public void refreshAvailableContentSelection()
-
showNoAvailableContentWarning
public boolean showNoAvailableContentWarning()
Returns whether the warning for missing available content should be shown.The warning is only visible when the linked entity selection is shown, no create-new selection is active, the current tenant has neither unassigned nor available content for the selected type, and the portal is not in create mode.
- Returns:
trueif the "no available content" warning should be rendered,falseotherwise.
-
hasNoPermissionToCreateContent
public boolean hasNoPermissionToCreateContent()
Returns whether a warning for missing create permissions should be shown.The warning is shown when the entity selection is visible, no unused linked entity is available for the selected type and tenant, and the current user is not allowed to create a new entity of that type.
- Returns:
trueif the missing-permission warning should be rendered,falseotherwise.
-
supportsCreateNewContentEntity
public boolean supportsCreateNewContentEntity(EUserPortalContentConfigType contentType)
-
showCreateNewContentButton
public boolean showCreateNewContentButton(EUserPortalContentConfigType contentType)
-
showSelectedContentEntityDialogButton
public boolean showSelectedContentEntityDialogButton(EUserPortalContentConfigType contentType)
-
prepareCreateNewContent
public void prepareCreateNewContent(EUserPortalContentConfigType contentType)
-
prepareContentEntityDialog
public void prepareContentEntityDialog(EUserPortalContentConfigType contentType)
Stores a snapshot of the current entity-related fields before a dialog is opened.The snapshot is used to restore the previous values when the user cancels the dialog without applying the changes.
- Parameters:
contentType- content type of the dialog to prepare
-
cancelContentEntityDialog
public void cancelContentEntityDialog()
Cancels the currently open content-entity dialog.Depending on the current mode, this either restores the previous selected content before the temporary selection change or re-applies the last dialog snapshot to the currently selected content.
-
applyContentEntityDialog
public void applyContentEntityDialog()
Applies the changes from the currently open content-entity dialog.This validates the dialog state, normalizes entity names where required, and stores a temporary display-name override so that the selection label stays consistent until the entity is persisted.
-
getContentEntityDialogHeaderKey
public String getContentEntityDialogHeaderKey(EUserPortalContentConfigType contentType)
-
getNoCreatePermissionWarningMessage
public String getNoCreatePermissionWarningMessage()
Returns the warning text that explains why no new linked entity can be created for the selected content type.- Returns:
- Localized warning text for the selected content type, or an empty string if no content type is selected.
-
getNoCreatePermissionWarningMessage
public String getNoCreatePermissionWarningMessage(EUserPortalContentConfigType contentType)
Returns the warning text that explains why no new linked entity can be created for the given content type.- Parameters:
contentType- The content type for which the warning text should be returned.- Returns:
- Localized warning text for the given content type, or an empty string if no content type is selected.
-
addContentTypeMenuItemDisabled
public boolean addContentTypeMenuItemDisabled(EUserPortalContentConfigType contentType)
Returns whether the add-menu entry for the given content type should be disabled.This evaluation is only done in a client portal because only there the tenant is fixed and permissions plus remaining unlinked entities can be evaluated reliably.
- Parameters:
contentType- The content type to evaluate.- Returns:
trueif no additional content of the given type can be created in the current client portal,falseotherwise.
-
getSelectedFormEntityUuid
public UUID getSelectedFormEntityUuid()
-
setSelectedFormEntityUuid
public void setSelectedFormEntityUuid(UUID selectedFormEntityUuid)
-
getSelectedTenantResourceEntityUuid
public UUID getSelectedTenantResourceEntityUuid()
-
setSelectedTenantResourceEntityUuid
public void setSelectedTenantResourceEntityUuid(UUID selectedTenantResourceEntityUuid)
-
getSelectedTenantTemplateEntityUuid
public UUID getSelectedTenantTemplateEntityUuid()
-
setSelectedTenantTemplateEntityUuid
public void setSelectedTenantTemplateEntityUuid(UUID selectedTenantTemplateEntityUuid)
-
isSelectedContentSaveBlocked
public boolean isSelectedContentSaveBlocked()
Returns whether saving the currently selected temporary portal content must be blocked.This is the case when the bean is in create mode, the selected content has not been persisted yet, no linked entity is currently selected, and either the user lacks permission to create a new entity or no selectable content is available.
- Returns:
trueif saving must be blocked,falseotherwise.
-
getSelectedContentSaveBlockedMessage
public String getSelectedContentSaveBlockedMessage()
Returns the localized message that explains why saving the current temporary content is blocked.Depending on the current state, this returns either the missing-permission warning or the warning that no selectable content is available.
- Returns:
- localized blocking message, or an empty string if saving is not blocked.
-
isContentSelectionDisabled
public boolean isContentSelectionDisabled(EUserPortalContentConfigType contentType)
Returns whether the selection component for the given content type should be disabled.The selection is disabled when there is currently no enabled existing entity that can be selected for the given content type.
- Parameters:
contentType- the content type whose selection component should be evaluated.- Returns:
trueif the selection should be disabled,falseotherwise.
-
isSelectedContentConfigurationVisible
public boolean isSelectedContentConfigurationVisible()
Returns whether the lower configuration area for the selected content should be shown.The configuration area is only visible when a content is selected, no missing-permission warning is active, and either an existing entity can be selected or the create-new flow is currently active.
- Returns:
trueif the configuration area should be rendered,falseotherwise.
-
getViewContextBean
public ViewContextBean getViewContextBean()
-
getUserManager
public SessionUserManager getUserManager()
-
getResourceBundleBean
public ResourceBundleBean getResourceBundleBean()
-
getLocaleBean
public LocaleBean getLocaleBean()
-
getUserPortalConfigBean
public UserPortalConfigBean getUserPortalConfigBean()
-
getAvailableClientsForNewPortalContent
public Map<UUID,String> getAvailableClientsForNewPortalContent()
-
getContentTypeStates
public EnumMap<EUserPortalContentConfigType,UserPortalContentTypeState> getContentTypeStates()
-
getTenantContentLoadResultCache
public Map<UUID,UserPortalTenantContentLoader.TenantContentLoadResult> getTenantContentLoadResultCache()
-
getLoadedTenantUuid
public UUID getLoadedTenantUuid()
-
getLoadedTenant
public Mandant getLoadedTenant()
-
isHasLoadedTenantAvailableContent
public boolean isHasLoadedTenantAvailableContent()
-
isHasLoadedTenantUnexistingContent
public boolean isHasLoadedTenantUnexistingContent()
-
isHasTenantResourceViewAccess
public boolean isHasTenantResourceViewAccess()
-
isHasTenantTemplateUrlViewAccess
public boolean isHasTenantTemplateUrlViewAccess()
-
getSelectedContentBeforeSelectionChange
public UserPortalContentViewModel getSelectedContentBeforeSelectionChange()
-
getContentEntityDialogSnapshot
public UserPortalContentDialogHelper.ContentEntityDialogSnapshot getContentEntityDialogSnapshot()
This field is used to temporarily store the state of the selected content's entity-related properties when opening the edit dialog for an existing content entity or preparing the create-new-content dialog, in order to be able to restore this state when canceling the dialog.
-
getSelectedContentTenantResourceFileToRemove
public UserPortalFileViewModel getSelectedContentTenantResourceFileToRemove()
-
setViewContextBean
public void setViewContextBean(ViewContextBean viewContextBean)
-
setUserManager
public void setUserManager(SessionUserManager userManager)
-
setResourceBundleBean
public void setResourceBundleBean(ResourceBundleBean resourceBundleBean)
-
setLocaleBean
public void setLocaleBean(LocaleBean localeBean)
-
setUserPortalConfigBean
public void setUserPortalConfigBean(UserPortalConfigBean userPortalConfigBean)
-
setAvailableClientsForNewPortalContent
public void setAvailableClientsForNewPortalContent(Map<UUID,String> availableClientsForNewPortalContent)
-
setLoadedTenantUuid
public void setLoadedTenantUuid(UUID loadedTenantUuid)
-
setLoadedTenant
public void setLoadedTenant(Mandant loadedTenant)
-
setHasLoadedTenantAvailableContent
public void setHasLoadedTenantAvailableContent(boolean hasLoadedTenantAvailableContent)
-
setHasLoadedTenantUnexistingContent
public void setHasLoadedTenantUnexistingContent(boolean hasLoadedTenantUnexistingContent)
-
setHasTenantResourceViewAccess
public void setHasTenantResourceViewAccess(boolean hasTenantResourceViewAccess)
-
setHasTenantTemplateUrlViewAccess
public void setHasTenantTemplateUrlViewAccess(boolean hasTenantTemplateUrlViewAccess)
-
setSelectedContentBeforeSelectionChange
public void setSelectedContentBeforeSelectionChange(UserPortalContentViewModel selectedContentBeforeSelectionChange)
-
setContentEntityDialogSnapshot
public void setContentEntityDialogSnapshot(UserPortalContentDialogHelper.ContentEntityDialogSnapshot contentEntityDialogSnapshot)
This field is used to temporarily store the state of the selected content's entity-related properties when opening the edit dialog for an existing content entity or preparing the create-new-content dialog, in order to be able to restore this state when canceling the dialog.
-
setSelectedContentTenantResourceFileToRemove
public void setSelectedContentTenantResourceFileToRemove(UserPortalFileViewModel selectedContentTenantResourceFileToRemove)
-
-