Package io.goobi.viewer.managedbeans
Class AdminBean
java.lang.Object
io.goobi.viewer.managedbeans.AdminBean
- All Implemented Interfaces:
Serializable
Administration backend functions.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds currentUserRole to the map of UserRoles to be processed, marked as to save.Resets selected message entry and returns to the translations overview page.intdeleteFromCache(List<String> identifiers, boolean fromContentCache, boolean fromThumbnailCache) deleteFromCache.intdeleteFromCache(List<String> identifiers, boolean fromContentCache, boolean fromThumbnailCache, boolean fromPdfCache) deleteFromCache.voiddeleteIpRangeAction(IpRange ipRange) deleteIpRangeAction.voiddeleteRoleAction(Role role) deleteRoleAction.deleteUserAction(User user, boolean deleteContributions) Deletes the given User and optionally their contributions.voiddeleteUserGroupAction(UserGroup userGroup) deleteUserGroupAction.voiddeleteUserRoleAction(UserRole userRole) Adds currentUserRole to the map of UserRoles to be processed, marked as to delete.getAllIpRanges.Returns a list of all existing roles.Returns all user groups in the DB.Returns all users in the DB.getAllUsersExcept(Set<User> usersToExclude) getAllUsersExcept.getConfiguredTranslationGroups.longgetConfiguredTranslationGroupsCount.Getter for the fieldcurrentIpRange.Returns the user ID ofcurrentIpRange.Getter for the fieldcurrentPassword.Getter for the fieldcurrentRole.Getter for the fieldcurrentTranslationGroup.intgetCurrentTranslationGroupId.getCurrentTranslationMessageKey.Getter for the fieldcurrentUser.Getter for the fieldcurrentUserGroup.Returns the user ID ofcurrentUserGroup.Returns the user ID ofcurrentUser.Getter for the fieldcurrentUserRole.Getter for the fieldemailConfirmation.intGetter for the fieldhotfolderFileCount.Getter for the fieldlazyModelUsers.getPageUsers.Getter for the fieldpasswordOne.Getter for the fieldpasswordTwo.getTranslationGroupForFieldAndKey(String field, String key) getTranslationGroupForFieldAndKey.static StringGetter for the fieldtranslationGroupsEditorSession.getTranslationGroupsForSolrField.static List<TranslationGroup> getTranslationGroupsForSolrFieldStatic.Getter for the fielduploadedAvatarFile.voidinit()init.booleanisDeleteUserContributions.booleanisDisplayTranslationsDashboardWidget.booleanisHasAccessPermissingForTranslationFiles.booleanisNewMessageEntryModeAllowed.booleanisTranslationLocked.voidlockTranslation.voidAjax event listener for saving the maintenance mode after the enabled/disabled status has been toggled.voidresetCurrentIpRangeAction.voidresetCurrentRoleAction.voidSafe reset method that prevents NPE in EL.voidresetCurrentUserAction.voidresetCurrentUserGroupAction.voidresetCurrentUserRoleAction.voidresetDirtyUserRolesAction.resetUserAction(User user, String returnPage) resetUserAction.voidSavescurrentTranslationGroupif it has a selected entry.saveIpRangeAction.saveMaintenanceModeAction.voidsaveRoleAction.Saves currently selected message entry in the current translation group and returns to the translations overview page.booleanSaves the given use.saveUserAction(User user, boolean forceCheckCurrentPassword, String returnPage) saveUserAction.Persists changes incurrentUserGroup.voidsetCurrentIpRange(IpRange currentIpRange) Setter for the fieldcurrentIpRange.voidSetscurrentIpRangeby loading it from the DB via the given ID.voidsetCurrentPassword(String currentPassword) Setter for the fieldcurrentPassword.voidsetCurrentRole(Role currentRole) Setter for the fieldcurrentRole.voidsetCurrentTranslationGroup(TranslationGroup currentTranslationGroup) Setter for the fieldcurrentTranslationGroup.voidsetCurrentTranslationGroupId(int id) setCurrentTranslationGroupId.voidIfcurrentTranslationGroupis set, looks up the message entry for the given key and pre-selects it.voidsetCurrentUser(User currentUser) Setter for the fieldcurrentUser.voidsetCurrentUserGroup(UserGroup userGroup) Setter for the fieldcurrentUserGroup.voidSetscurrentUserGroupby loading it from the DB via the given ID.voidsetCurrentUserId(Long id) Sets the current user by loading them from the DB via the given user ID.voidsetCurrentUserRole(UserRole currentUserRole) Setter for the fieldcurrentUserRole.voidsetDeleteUserContributions(boolean deleteUserContributions) Setter for the fielddeleteUserContributions.voidsetEmailConfirmation(String emailConfirmation) Setter for the fieldemailConfirmation.voidsetMaintenanceMode(MaintenanceMode maintenanceMode) voidsetPasswordOne(String passwordOne) Setter for the fieldpasswordOne.voidsetPasswordTwo(String passwordTwo) Setter for the fieldpasswordTwo.setRepresantativeImageAction(String pi, String dataRepository, String fileIdRoot) setRepresantativeImageAction.static voidsetRepresantativeImageStatic(String pi, String dataRepository, String fileIdRoot) Opens the METS file for the given identifier and sets the attribute USE='banner' to all file elements that match the given file ID root.static voidsetTranslationGroupsEditorSession(String translationGroupsEditorSession) Setter for the fieldtranslationGroupsEditorSession.voidsetUploadedAvatarFile(Part uploadedAvatarFile) Setter for the fielduploadedAvatarFile.toggleSuspendUserAction(User user) toggleSuspendUserAction.voidtriggerMessage(String message) triggerMessage.voidTriggers a mode for adding new message keys to the first LOCAL_STRINGS type group found.voidupdateHotfolderFileCount.voidsaveUserRoleAction.
-
Constructor Details
-
AdminBean
public AdminBean()Creates a new AdminBean instance.
-
-
Method Details
-
init
init. -
getAllUsers
Returns all users in the DB. Needed for getting a list of users (e.g for adding user group members).- Returns:
- a list of all registered users sorted by display name
- Throws:
DAOException- if any.
-
getAllUsersExcept
getAllUsersExcept.- Parameters:
usersToExclude- set of users to omit from the result- Returns:
- a list of all registered users excluding the specified users
- Throws:
DAOException- if any.
-
saveUserAction
public String saveUserAction(User user, boolean forceCheckCurrentPassword, String returnPage) throws DAOException saveUserAction.- Parameters:
user- user to saveforceCheckCurrentPassword- If true, even if an admin is changing their own passwordreturnPage- navigation outcome returned on success- Returns:
- the navigation outcome for the return page on success, or empty string on failure
- Throws:
DAOException- if any.
-
resetUserAction
resetUserAction.- Parameters:
user- user whose fields are restored from backupreturnPage- navigation outcome to return after reset- Returns:
- the navigation outcome for the return page
-
saveUser
Saves the given use. Attention: Used by regular users editing their own profile as well.- Parameters:
user- User to saveforceCheckCurrentPassword- If true, even if an admin is changing their own password- Returns:
- true if the user was saved successfully, false otherwise
- Throws:
DAOException- if any.
-
deleteUserAction
Deletes the given User and optionally their contributions. This method is user for admin-induced deletion of other users as well as self-deletion by a user.- Parameters:
user- User to be deleteddeleteContributions- If true, all content created by this user will also be deleted- Returns:
- Navigation outcome
- Throws:
DAOException- if any.
-
resetCurrentUserAction
public void resetCurrentUserAction()resetCurrentUserAction. -
getAllUserGroups
Returns all user groups in the DB. Needed for getting a list of users (e.g for adding user group members).- Returns:
- a list of all user groups in the database
- Throws:
DAOException- if any.
-
saveUserGroupAction
Persists changes incurrentUserGroup.- Returns:
- Navigation outcome
- Throws:
DAOException- if any.
-
deleteUserGroupAction
deleteUserGroupAction.- Parameters:
userGroup- user group to delete from the database- Throws:
DAOException- if any.
-
resetCurrentUserGroupAction
public void resetCurrentUserGroupAction()resetCurrentUserGroupAction. -
getAllRoles
Returns a list of all existing roles. Required for admin tab components.- Returns:
- a list of all role definitions in the database
- Throws:
DAOException- if any.
-
saveRoleAction
saveRoleAction.- Throws:
DAOException- if any.
-
deleteRoleAction
deleteRoleAction.- Parameters:
role- role to delete from the database- Throws:
DAOException- if any.
-
resetCurrentRoleAction
public void resetCurrentRoleAction()resetCurrentRoleAction. -
resetCurrentUserRoleAction
public void resetCurrentUserRoleAction()resetCurrentUserRoleAction. -
resetDirtyUserRolesAction
public void resetDirtyUserRolesAction()resetDirtyUserRolesAction. -
addUserRoleAction
Adds currentUserRole to the map of UserRoles to be processed, marked as to save.- Throws:
DAOException
-
deleteUserRoleAction
Adds currentUserRole to the map of UserRoles to be processed, marked as to delete.- Parameters:
userRole- membership entry to mark for deletion- Throws:
DAOException- if any.
-
updateUserRoles
saveUserRoleAction.- Throws:
DAOException- if any.
-
getAllIpRanges
getAllIpRanges.- Returns:
- all IpRanges from the database
- Throws:
DAOException
-
saveIpRangeAction
saveIpRangeAction.- Returns:
- Navigation outcome
- Throws:
DAOException- if any.
-
deleteIpRangeAction
deleteIpRangeAction.- Parameters:
ipRange- IP range entry to delete from the database- Throws:
DAOException- if any.
-
resetCurrentIpRangeAction
public void resetCurrentIpRangeAction()resetCurrentIpRangeAction. -
saveMaintenanceModeAction
saveMaintenanceModeAction.- Returns:
- Navigation outcome
- Throws:
DAOException- if any.
-
maintenanceModeToggleChangedListener
Ajax event listener for saving the maintenance mode after the enabled/disabled status has been toggled. Using a valueChangeListener instead (via viewerComponent:toggleSwitch) resulted in the listener firing before the setter.- Parameters:
event-AjaxBehaviorEvent- Throws:
DAOException
-
getCurrentUser
Getter for the fieldcurrentUser.- Returns:
- the
Usercurrently being edited in the admin interface, or null if none selected
-
setCurrentUser
Setter for the fieldcurrentUser.- Parameters:
currentUser- the user currently being edited in the admin interface
-
getCurrentUserId
Returns the user ID ofcurrentUser.- Returns:
currentUser.idif loaded and has ID; null if not
-
setCurrentUserId
Sets the current user by loading them from the DB via the given user ID.- Parameters:
id- database ID of the user to load- Throws:
DAOException
-
getCurrentUserGroup
Getter for the fieldcurrentUserGroup.- Returns:
- the user group currently selected for editing
-
setCurrentUserGroup
Setter for the fieldcurrentUserGroup.- Parameters:
userGroup- user group to set as currently edited
-
getCurrentUserGroupId
Returns the user ID ofcurrentUserGroup.- Returns:
currentUserGroup.idif loaded and has ID; null if not
-
setCurrentUserGroupId
SetscurrentUserGroupby loading it from the DB via the given ID.- Parameters:
id- database ID of the user group to load- Throws:
DAOException
-
getCurrentRole
Getter for the fieldcurrentRole.- Returns:
- the
Rolecurrently being edited in the admin interface, or null if none selected
-
setCurrentRole
Setter for the fieldcurrentRole.- Parameters:
currentRole- the role currently being edited in the admin interface
-
getCurrentUserRole
Getter for the fieldcurrentUserRole.- Returns:
- the
UserRoleassignment currently being edited, or null if none selected
-
setCurrentUserRole
Setter for the fieldcurrentUserRole.- Parameters:
currentUserRole- the user-role assignment currently being edited
-
getCurrentIpRange
Getter for the fieldcurrentIpRange.- Returns:
- the
IpRangecurrently being edited in the admin interface, or null if none selected
-
setCurrentIpRange
Setter for the fieldcurrentIpRange.- Parameters:
currentIpRange- the IP range currently being edited in the admin interface
-
getCurrentIpRangeId
Returns the user ID ofcurrentIpRange.- Returns:
currentIpRange.idif loaded and has ID; null if not
-
setCurrentIpRangeId
SetscurrentIpRangeby loading it from the DB via the given ID.- Parameters:
id- database ID of the IP range to load- Throws:
DAOException
-
getLazyModelUsers
Getter for the fieldlazyModelUsers.- Returns:
- the
TableDataProviderused for paginated user listing in the admin interface
-
getPageUsers
getPageUsers.- Returns:
- a list of users for the current page in the paginated user list
-
getCurrentPassword
Getter for the fieldcurrentPassword.- Returns:
- the current password entered for verification, or null if not set
-
setCurrentPassword
Setter for the fieldcurrentPassword.- Parameters:
currentPassword- the current password entered for verification
-
getPasswordOne
Getter for the fieldpasswordOne.- Returns:
- the new password entered in the first password field, or null if not set
-
setPasswordOne
Setter for the fieldpasswordOne.- Parameters:
passwordOne- the new password entered in the first password field
-
getPasswordTwo
Getter for the fieldpasswordTwo.- Returns:
- the new password entered in the confirmation password field, or null if not set
-
setPasswordTwo
Setter for the fieldpasswordTwo.- Parameters:
passwordTwo- the new password entered in the confirmation password field
-
getEmailConfirmation
Getter for the fieldemailConfirmation.- Returns:
- the email address entered for confirmation during account deletion, or null if not set
-
setEmailConfirmation
Setter for the fieldemailConfirmation.- Parameters:
emailConfirmation- the email address entered for confirmation during account deletion
-
isDeleteUserContributions
public boolean isDeleteUserContributions()isDeleteUserContributions.- Returns:
- true if all user contributions (comments, bookmarks) should be deleted when deleting the user account; false otherwise
-
setDeleteUserContributions
public void setDeleteUserContributions(boolean deleteUserContributions) Setter for the fielddeleteUserContributions.- Parameters:
deleteUserContributions- true to delete all user contributions (comments, bookmarks) when deleting the user account
-
deleteFromCache
public int deleteFromCache(List<String> identifiers, boolean fromContentCache, boolean fromThumbnailCache) deleteFromCache.- Parameters:
identifiers- list of record identifiers to evict from cachefromContentCache- true to clear entries from the content cachefromThumbnailCache- true to clear entries from the thumbnail cache- Returns:
- a int.
-
deleteFromCache
public int deleteFromCache(List<String> identifiers, boolean fromContentCache, boolean fromThumbnailCache, boolean fromPdfCache) throws DAOException deleteFromCache.- Parameters:
identifiers- list of record identifiers to evict from cachefromContentCache- true to clear entries from the content cachefromThumbnailCache- true to clear entries from the thumbnail cachefromPdfCache- true to delete PDF download jobs and files for each identifier- Returns:
- a int.
- Throws:
DAOException
-
setRepresantativeImageAction
setRepresantativeImageAction.- Parameters:
pi- persistent identifier of the record to updatedataRepository- data repository path containing the METS filefileIdRoot- file ID prefix of the image to mark as representative- Returns:
- an empty string after setting the representative image in the METS file
-
setRepresantativeImageStatic
public static void setRepresantativeImageStatic(String pi, String dataRepository, String fileIdRoot) Opens the METS file for the given identifier and sets the attribute USE='banner' to all file elements that match the given file ID root. Any USE='banner' attributes that do not match the file ID root are removed. Solr schema version "intranda_viewer-20130117" or newer required.- Parameters:
pi- persistent identifier of the record to updatedataRepository- data repository path containing the METS filefileIdRoot- file ID prefix of the image to mark as representative
-
toggleSuspendUserAction
toggleSuspendUserAction.- Parameters:
user- user whose suspended status to toggle- Returns:
- an empty string after toggling the user's suspended status
- Throws:
DAOException- if any.
-
triggerMessage
triggerMessage.- Parameters:
message- message key to look up and display as info
-
isDisplayTranslationsDashboardWidget
public boolean isDisplayTranslationsDashboardWidget()isDisplayTranslationsDashboardWidget.- Returns:
- true if at least one group is not fully translated; false otherwise
-
getConfiguredTranslationGroupsCount
public long getConfiguredTranslationGroupsCount()getConfiguredTranslationGroupsCount.- Returns:
- Number of configured translation grouns
-
getConfiguredTranslationGroups
getConfiguredTranslationGroups.- Returns:
- All configured
TranslationGroups
-
getTranslationGroupsForSolrField
getTranslationGroupsForSolrField.- Parameters:
field- Index field that the translation groups should have as a key- Returns:
- List of TranslationGroups; null if not found
-
getTranslationGroupForFieldAndKey
getTranslationGroupForFieldAndKey.- Parameters:
field- Solr fieldkey- Message key- Returns:
- First
TranslationGroupthat contains the requested field+key; null if none found
-
getTranslationGroupsForSolrFieldStatic
getTranslationGroupsForSolrFieldStatic.- Parameters:
field- Index field that the translation groups should have as a key- Returns:
- List of TranslationGroups; null if not found
-
saveAndResetCurrentTranslationGroup
public void saveAndResetCurrentTranslationGroup()SavescurrentTranslationGroupif it has a selected entry. Resets group to null afterwards. -
getCurrentTranslationGroup
Getter for the fieldcurrentTranslationGroup.- Returns:
- the
TranslationGroupcurrently being edited, or null if none selected or session is locked
-
resetCurrentTranslationGroupStatusCount
public void resetCurrentTranslationGroupStatusCount()Safe reset method that prevents NPE in EL. -
setCurrentTranslationGroup
Setter for the fieldcurrentTranslationGroup.- Parameters:
currentTranslationGroup- the translation group currently being edited
-
isNewMessageEntryModeAllowed
public boolean isNewMessageEntryModeAllowed()isNewMessageEntryModeAllowed.- Returns:
- true if at least one LOCAL_STRINGS type group is found in config; false otherwise
-
triggerNewMessageEntryMode
public void triggerNewMessageEntryMode()Triggers a mode for adding new message keys to the first LOCAL_STRINGS type group found. -
saveSelectedMessageEntryAction
Saves currently selected message entry in the current translation group and returns to the translations overview page.- Returns:
- Target page
-
cancelSelectedMessageEntryAction
Resets selected message entry and returns to the translations overview page.- Returns:
- Target page
-
getCurrentTranslationGroupId
public int getCurrentTranslationGroupId()getCurrentTranslationGroupId.- Returns:
- Index of currentTranslationGroup in the list of configured groups
-
setCurrentTranslationGroupId
public void setCurrentTranslationGroupId(int id) setCurrentTranslationGroupId.- Parameters:
id- Looks up and loadscurrentTranslationGroupthat matches the given id
-
getCurrentTranslationMessageKey
getCurrentTranslationMessageKey.- Returns:
- Key of the currently selected entry; otherwise "-"
-
setCurrentTranslationMessageKey
IfcurrentTranslationGroupis set, looks up the message entry for the given key and pre-selects it.- Parameters:
key- Message key to select
-
isTranslationLocked
public boolean isTranslationLocked()isTranslationLocked.- Returns:
- true if translations are locked by a different user; false otherwise
-
lockTranslation
public void lockTranslation()lockTranslation. -
getTranslationGroupsEditorSession
Getter for the fieldtranslationGroupsEditorSession.- Returns:
- the session identifier that holds the translation groups editor lock, or null if not locked
-
setTranslationGroupsEditorSession
Setter for the fieldtranslationGroupsEditorSession.- Parameters:
translationGroupsEditorSession- session identifier used to coordinate the translation groups editor
-
updateHotfolderFileCount
public void updateHotfolderFileCount()updateHotfolderFileCount. -
getHotfolderFileCount
public int getHotfolderFileCount()Getter for the fieldhotfolderFileCount.- Returns:
- Number of queued records in hotfolder
-
isHasAccessPermissingForTranslationFiles
public boolean isHasAccessPermissingForTranslationFiles()isHasAccessPermissingForTranslationFiles.- Returns:
TranslationGroup.isHasFileAccess()
-
setUploadedAvatarFile
Setter for the fielduploadedAvatarFile.- Parameters:
uploadedAvatarFile- the uploaded file part containing the new avatar image
-
getUploadedAvatarFile
Getter for the fielduploadedAvatarFile.- Returns:
- the uploaded file part containing the new avatar image, or null if none uploaded
-
getMaintenanceMode
-
setMaintenanceMode
-